[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c117c5d5-e864-068b-a1fe-961e2eeba84c@linaro.org>
Date: Tue, 20 Sep 2022 15:32:03 +0200
From: Neil Armstrong <neil.armstrong@...aro.org>
To: Lin Yujun <linyujun809@...wei.com>, agross@...nel.org,
bjorn.andersson@...aro.org, konrad.dybcio@...ainline.org,
srinivas.kandagatla@...aro.org, gregkh@...uxfoundation.org,
vkoul@...nel.org
Cc: linux-arm-msm@...r.kernel.org, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] slimbus: qcom-ngd: Add error handling in
of_qcom_slim_ngd_register
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@...wei.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@...aro.org>
Powered by blists - more mailing lists