Skip to content

Commit 57449b0

Browse files
Bhaumik BhattKalle Valo
authored andcommitted
ath11k: use MHI provided APIs to allocate and free MHI controller
Use MHI provided APIs to allocate and free MHI controller to improve MHI host driver handling. This also fixes a memory leak as the MHI controller was allocated but never freed. Signed-off-by: Bhaumik Bhatt <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5dadbe4 commit 57449b0

File tree

1 file changed

+4
-3
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+4
-3
lines changed

drivers/net/wireless/ath/ath11k/mhi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
214214
struct mhi_controller *mhi_ctrl;
215215
int ret;
216216

217-
mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
217+
mhi_ctrl = mhi_alloc_controller();
218218
if (!mhi_ctrl)
219219
return -ENOMEM;
220220

@@ -230,7 +230,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
230230
ret = ath11k_mhi_get_msi(ab_pci);
231231
if (ret) {
232232
ath11k_err(ab, "failed to get msi for mhi\n");
233-
kfree(mhi_ctrl);
233+
mhi_free_controller(mhi_ctrl);
234234
return ret;
235235
}
236236

@@ -248,7 +248,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
248248
ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
249249
if (ret) {
250250
ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
251-
kfree(mhi_ctrl);
251+
mhi_free_controller(mhi_ctrl);
252252
return ret;
253253
}
254254

@@ -261,6 +261,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci)
261261

262262
mhi_unregister_controller(mhi_ctrl);
263263
kfree(mhi_ctrl->irq);
264+
mhi_free_controller(mhi_ctrl);
264265
}
265266

266267
static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)

0 commit comments

Comments
 (0)