Commit 57449b07 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt Committed by Kalle Valo

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: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1605634436-36506-1-git-send-email-bbhatt@codeaurora.org
parent 5dadbe4e
...@@ -214,7 +214,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ...@@ -214,7 +214,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
struct mhi_controller *mhi_ctrl; struct mhi_controller *mhi_ctrl;
int ret; int ret;
mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL); mhi_ctrl = mhi_alloc_controller();
if (!mhi_ctrl) if (!mhi_ctrl)
return -ENOMEM; return -ENOMEM;
...@@ -230,7 +230,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ...@@ -230,7 +230,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = ath11k_mhi_get_msi(ab_pci); ret = ath11k_mhi_get_msi(ab_pci);
if (ret) { if (ret) {
ath11k_err(ab, "failed to get msi for mhi\n"); ath11k_err(ab, "failed to get msi for mhi\n");
kfree(mhi_ctrl); mhi_free_controller(mhi_ctrl);
return ret; return ret;
} }
...@@ -248,7 +248,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ...@@ -248,7 +248,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config); ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
if (ret) { if (ret) {
ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret); ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
kfree(mhi_ctrl); mhi_free_controller(mhi_ctrl);
return ret; return ret;
} }
...@@ -261,6 +261,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci) ...@@ -261,6 +261,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci)
mhi_unregister_controller(mhi_ctrl); mhi_unregister_controller(mhi_ctrl);
kfree(mhi_ctrl->irq); kfree(mhi_ctrl->irq);
mhi_free_controller(mhi_ctrl);
} }
static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state) static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment