Skip to content

Commit 42992cf

Browse files
Lin Yujungregkh
authored andcommitted
slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
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: 917809e ("slimbus: ngd: Add qcom SLIMBus NGD driver") Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Lin Yujun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bd12445 commit 42992cf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/slimbus/qcom-ngd-ctrl.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,13 @@ static int of_qcom_slim_ngd_register(struct device *parent,
14701470
ngd->pdev->dev.of_node = node;
14711471
ctrl->ngd = ngd;
14721472

1473-
platform_device_add(ngd->pdev);
1473+
ret = platform_device_add(ngd->pdev);
1474+
if (ret) {
1475+
platform_device_put(ngd->pdev);
1476+
kfree(ngd);
1477+
of_node_put(node);
1478+
return ret;
1479+
}
14741480
ngd->base = ctrl->base + ngd->id * data->offset +
14751481
(ngd->id - 1) * data->size;
14761482

0 commit comments

Comments
 (0)