* [PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
@ 2022-09-14 3:19 Lin Yujun
2022-09-20 13:32 ` Neil Armstrong
0 siblings, 1 reply; 2+ messages in thread
From: Lin Yujun @ 2022-09-14 3:19 UTC (permalink / raw)
To: agross, bjorn.andersson, konrad.dybcio, srinivas.kandagatla,
gregkh, vkoul
Cc: linux-arm-msm, alsa-devel, linux-kernel
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: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
---
drivers/slimbus/qcom-ngd-ctrl.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 0aa8408464ad..fb591990ddad 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -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;
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
2022-09-14 3:19 [PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register Lin Yujun
@ 2022-09-20 13:32 ` Neil Armstrong
0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2022-09-20 13:32 UTC (permalink / raw)
To: Lin Yujun, agross, bjorn.andersson, konrad.dybcio,
srinivas.kandagatla, gregkh, vkoul
Cc: linux-arm-msm, alsa-devel, linux-kernel
On 14/09/2022 05:19, Lin Yujun wrote:
> 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: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---
> drivers/slimbus/qcom-ngd-ctrl.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
> index 0aa8408464ad..fb591990ddad 100644
> --- a/drivers/slimbus/qcom-ngd-ctrl.c
> +++ b/drivers/slimbus/qcom-ngd-ctrl.c
> @@ -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;
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-20 13:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 3:19 [PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register Lin Yujun
2022-09-20 13:32 ` Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®