mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Lin Yujun <linyujun809@huawei.com>,
	agross@kernel.org, bjorn.andersson@linaro.org,
	konrad.dybcio@somainline.org, srinivas.kandagatla@linaro.org,
	gregkh@linuxfoundation.org, vkoul@kernel.org
Cc: linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
Date: Tue, 20 Sep 2022 15:32:03 +0200	[thread overview]
Message-ID: <c117c5d5-e864-068b-a1fe-961e2eeba84c@linaro.org> (raw)
In-Reply-To: <20220914031953.94061-1-linyujun809@huawei.com>

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>

      reply	other threads:[~2022-09-20 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  3:19 Lin Yujun
2022-09-20 13:32 ` Neil Armstrong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c117c5d5-e864-068b-a1fe-961e2eeba84c@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=agross@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyujun809@huawei.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®