mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
[ Upstream commit42992cf187
] No error handling is performed when platform_device_add() return fails. Refer to the error handling of driver_set_override(), add error handling for platform_device_add(). Fixes:917809e228
("slimbus: ngd: Add qcom SLIMBus NGD driver") Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Lin Yujun <linyujun809@huawei.com> Link: https://lore.kernel.org/r/20220914031953.94061-1-linyujun809@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e8ce7655fd
commit
eec8e868bd
1 changed files with 7 additions and 1 deletions
|
@ -1470,7 +1470,13 @@ static int of_qcom_slim_ngd_register(struct device *parent,
|
|||
ngd->pdev->dev.of_node = node;
|
||||
ctrl->ngd = ngd;
|
||||
|
||||
platform_device_add(ngd->pdev);
|
||||
ret = platform_device_add(ngd->pdev);
|
||||
if (ret) {
|
||||
platform_device_put(ngd->pdev);
|
||||
kfree(ngd);
|
||||
of_node_put(node);
|
||||
return ret;
|
||||
}
|
||||
ngd->base = ctrl->base + ngd->id * data->offset +
|
||||
(ngd->id - 1) * data->size;
|
||||
|
||||
|
|
Loading…
Reference in a new issue