public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Andy Gross <agross@kernel.org>, Luca Weiss <luca@z3ntu.xyz>,
	Brian Masney <masneyb@onstation.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem
Date: Mon, 31 Jan 2022 16:14:39 -0600	[thread overview]
Message-ID: <YfhfT0EC393GxSRd@builder.lan> (raw)
In-Reply-To: <20220107073126.2335-1-linmq006@gmail.com>

On Fri 07 Jan 01:31 CST 2022, Miaoqian Lin wrote:

> The reference taken by 'of_find_device_by_node()' must be released when
> not needed anymore.
> Add the corresponding 'put_device()' in the error handling path.
> 
> Fixes: 01f937ffc468 ("soc: qcom: ocmem: don't return NULL in of_get_ocmem")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Your patch solves the particular problem, so I'm applying it.

But it seems that we never release pdev in the case of successfully
return the ocmem object either... So there's more to improve here.

Regards,
Bjorn

> ---
>  drivers/soc/qcom/ocmem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c
> index d2dacbbaafbd..97fd24c178f8 100644
> --- a/drivers/soc/qcom/ocmem.c
> +++ b/drivers/soc/qcom/ocmem.c
> @@ -206,6 +206,7 @@ struct ocmem *of_get_ocmem(struct device *dev)
>  	ocmem = platform_get_drvdata(pdev);
>  	if (!ocmem) {
>  		dev_err(dev, "Cannot get ocmem\n");
> +		put_device(&pdev->dev);
>  		return ERR_PTR(-ENODEV);
>  	}
>  	return ocmem;
> -- 
> 2.17.1
> 

  reply	other threads:[~2022-01-31 22:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  7:31 [PATCH] soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem Miaoqian Lin
2022-01-31 22:14 ` Bjorn Andersson [this message]
2022-03-01  6:58   ` Miaoqian Lin
2022-02-04 18:35 ` (subset) " Bjorn Andersson

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=YfhfT0EC393GxSRd@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca@z3ntu.xyz \
    --cc=masneyb@onstation.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