Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function
[ Upstream commit 9a39a927be01d89e53f04304ab99a8761e08910d ] Some resource should be released in the error handling path of the probe function, as already done in the remove function. The remove function was fixed in commit5052de8def
("soc: qcom: smd: Transition client drivers from smd to rpmsg") Fixes:1511cc750c
("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
fa336bddbe
commit
fdbed2d740
@@ -142,12 +142,16 @@ static int btqcomsmd_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
btq->cmd_channel = qcom_wcnss_open_channel(wcnss, "APPS_RIVA_BT_CMD",
|
btq->cmd_channel = qcom_wcnss_open_channel(wcnss, "APPS_RIVA_BT_CMD",
|
||||||
btqcomsmd_cmd_callback, btq);
|
btqcomsmd_cmd_callback, btq);
|
||||||
if (IS_ERR(btq->cmd_channel))
|
if (IS_ERR(btq->cmd_channel)) {
|
||||||
return PTR_ERR(btq->cmd_channel);
|
ret = PTR_ERR(btq->cmd_channel);
|
||||||
|
goto destroy_acl_channel;
|
||||||
|
}
|
||||||
|
|
||||||
hdev = hci_alloc_dev();
|
hdev = hci_alloc_dev();
|
||||||
if (!hdev)
|
if (!hdev) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto destroy_cmd_channel;
|
||||||
|
}
|
||||||
|
|
||||||
hci_set_drvdata(hdev, btq);
|
hci_set_drvdata(hdev, btq);
|
||||||
btq->hdev = hdev;
|
btq->hdev = hdev;
|
||||||
@@ -161,14 +165,21 @@ static int btqcomsmd_probe(struct platform_device *pdev)
|
|||||||
hdev->set_bdaddr = qca_set_bdaddr_rome;
|
hdev->set_bdaddr = qca_set_bdaddr_rome;
|
||||||
|
|
||||||
ret = hci_register_dev(hdev);
|
ret = hci_register_dev(hdev);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
hci_free_dev(hdev);
|
goto hci_free_dev;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, btq);
|
platform_set_drvdata(pdev, btq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
hci_free_dev:
|
||||||
|
hci_free_dev(hdev);
|
||||||
|
destroy_cmd_channel:
|
||||||
|
rpmsg_destroy_ept(btq->cmd_channel);
|
||||||
|
destroy_acl_channel:
|
||||||
|
rpmsg_destroy_ept(btq->acl_channel);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btqcomsmd_remove(struct platform_device *pdev)
|
static int btqcomsmd_remove(struct platform_device *pdev)
|
||||||
|
Reference in New Issue
Block a user