All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
@ 2021-12-30  8:41 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2021-12-30  8:41 UTC (permalink / raw)
  Cc: linmq006, Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	Ikjoon Jang, linux-mediatek, linux-kernel, linux-arm-kernel

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;
+		}
 		smi_com_dev = &smi_com_pdev->dev;
 		link = device_link_add(dev, smi_com_dev,
 				       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
@ 2021-12-30  8:41 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2021-12-30  8:41 UTC (permalink / raw)
  Cc: linmq006, Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	Ikjoon Jang, linux-mediatek, linux-kernel, linux-arm-kernel

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;
+		}
 		smi_com_dev = &smi_com_pdev->dev;
 		link = device_link_add(dev, smi_com_dev,
 				       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
-- 
2.17.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
@ 2021-12-30  8:41 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2021-12-30  8:41 UTC (permalink / raw)
  Cc: linmq006, Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	Ikjoon Jang, linux-mediatek, linux-kernel, linux-arm-kernel

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;
+		}
 		smi_com_dev = &smi_com_pdev->dev;
 		link = device_link_add(dev, smi_com_dev,
 				       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
-- 
2.17.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
  2021-12-30  8:41 ` Miaoqian Lin
  (?)
@ 2021-12-30 10:49   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-12-30 10:49 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Yong Wu, Matthias Brugger, Ikjoon Jang, linux-mediatek,
	linux-kernel, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
@ 2021-12-30 10:49   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-12-30 10:49 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Yong Wu, Matthias Brugger, Ikjoon Jang, linux-mediatek,
	linux-kernel, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
@ 2021-12-30 10:49   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-12-30 10:49 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Yong Wu, Matthias Brugger, Ikjoon Jang, linux-mediatek,
	linux-kernel, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-30 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-12-30 10:49   ` Krzysztof Kozlowski
2021-12-30 10:49   ` Krzysztof Kozlowski

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.