All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Yong Wu <yong.wu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Ikjoon Jang <ikjn@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
Date: Thu, 30 Dec 2021 11:49:48 +0100	[thread overview]
Message-ID: <c1050d0d-55ae-a626-58c5-b0fab6f8f0c3@canonical.com> (raw)
In-Reply-To: <20211230084115.5375-1-linmq006@gmail.com>

On 30/12/2021 09:41, 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 paths.
> 
> Fixes: 4740475 ("memory: mtk-smi: Add device link for smi-sub-common")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/memory/mtk-smi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index e201e5976f34..2131f2c9e7ed 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -386,8 +386,10 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de
>  	of_node_put(smi_com_node);
>  	if (smi_com_pdev) {
>  		/* smi common is the supplier, Make sure it is ready before */
> -		if (!platform_get_drvdata(smi_com_pdev))
> +		if (!platform_get_drvdata(smi_com_pdev)) {
> +			put_device(&smi_com_pdev->dev);
>  			return -EPROBE_DEFER;
> +		}

What about other return paths (-ENODEV, 0)?


Best regards,
Krzysztof

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Yong Wu <yong.wu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Ikjoon Jang <ikjn@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
Date: Thu, 30 Dec 2021 11:49:48 +0100	[thread overview]
Message-ID: <c1050d0d-55ae-a626-58c5-b0fab6f8f0c3@canonical.com> (raw)
In-Reply-To: <20211230084115.5375-1-linmq006@gmail.com>

On 30/12/2021 09:41, 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 paths.
> 
> Fixes: 4740475 ("memory: mtk-smi: Add device link for smi-sub-common")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/memory/mtk-smi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index e201e5976f34..2131f2c9e7ed 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -386,8 +386,10 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de
>  	of_node_put(smi_com_node);
>  	if (smi_com_pdev) {
>  		/* smi common is the supplier, Make sure it is ready before */
> -		if (!platform_get_drvdata(smi_com_pdev))
> +		if (!platform_get_drvdata(smi_com_pdev)) {
> +			put_device(&smi_com_pdev->dev);
>  			return -EPROBE_DEFER;
> +		}

What about other return paths (-ENODEV, 0)?


Best regards,
Krzysztof

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Yong Wu <yong.wu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Ikjoon Jang <ikjn@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
Date: Thu, 30 Dec 2021 11:49:48 +0100	[thread overview]
Message-ID: <c1050d0d-55ae-a626-58c5-b0fab6f8f0c3@canonical.com> (raw)
In-Reply-To: <20211230084115.5375-1-linmq006@gmail.com>

On 30/12/2021 09:41, 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 paths.
> 
> Fixes: 4740475 ("memory: mtk-smi: Add device link for smi-sub-common")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/memory/mtk-smi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index e201e5976f34..2131f2c9e7ed 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -386,8 +386,10 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de
>  	of_node_put(smi_com_node);
>  	if (smi_com_pdev) {
>  		/* smi common is the supplier, Make sure it is ready before */
> -		if (!platform_get_drvdata(smi_com_pdev))
> +		if (!platform_get_drvdata(smi_com_pdev)) {
> +			put_device(&smi_com_pdev->dev);
>  			return -EPROBE_DEFER;
> +		}

What about other return paths (-ENODEV, 0)?


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-30 10:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30  8:41 [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common Miaoqian Lin
2021-12-30  8:41 ` Miaoqian Lin
2021-12-30  8:41 ` Miaoqian Lin
2021-12-30 10:49 ` Krzysztof Kozlowski [this message]
2021-12-30 10:49   ` Krzysztof Kozlowski
2021-12-30 10:49   ` Krzysztof Kozlowski

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=c1050d0d-55ae-a626-58c5-b0fab6f8f0c3@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=ikjn@chromium.org \
    --cc=linmq006@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=yong.wu@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.