stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path
@ 2022-03-03 18:06 Johan Hovold
  2022-03-18 12:53 ` Krzysztof Kozlowski
  2022-04-04 17:08 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2022-03-03 18:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: linux-kernel, Johan Hovold, stable, Sergei Shtylyov

Make sure to free the flash platform device in the event that
registration fails during probe.

Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
Cc: stable@vger.kernel.org      # 5.8
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/memory/renesas-rpc-if.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index e4cc64f56019..2e545f473cc6 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -651,6 +651,7 @@ static int rpcif_probe(struct platform_device *pdev)
 	struct platform_device *vdev;
 	struct device_node *flash;
 	const char *name;
+	int ret;
 
 	flash = of_get_next_child(pdev->dev.of_node, NULL);
 	if (!flash) {
@@ -674,7 +675,14 @@ static int rpcif_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	vdev->dev.parent = &pdev->dev;
 	platform_set_drvdata(pdev, vdev);
-	return platform_device_add(vdev);
+
+	ret = platform_device_add(vdev);
+	if (ret) {
+		platform_device_put(vdev);
+		return ret;
+	}
+
+	return 0;
 }
 
 static int rpcif_remove(struct platform_device *pdev)
-- 
2.34.1


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

* Re: [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path
  2022-03-03 18:06 [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path Johan Hovold
@ 2022-03-18 12:53 ` Krzysztof Kozlowski
  2022-04-04 17:08 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-18 12:53 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-kernel, stable, Sergei Shtylyov

On 03/03/2022 19:06, Johan Hovold wrote:
> Make sure to free the flash platform device in the event that
> registration fails during probe.
> 
> Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
> Cc: stable@vger.kernel.org      # 5.8
> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/memory/renesas-rpc-if.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 

It's too late for upcoming cycle, so I will pick it up after the merge
window.


Best regards,
Krzysztof

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

* Re: [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path
  2022-03-03 18:06 [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path Johan Hovold
  2022-03-18 12:53 ` Krzysztof Kozlowski
@ 2022-04-04 17:08 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-04 17:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Johan Hovold
  Cc: Krzysztof Kozlowski, Sergei Shtylyov, stable, linux-kernel

On Thu, 3 Mar 2022 19:06:32 +0100, Johan Hovold wrote:
> Make sure to free the flash platform device in the event that
> registration fails during probe.
> 
> 

Applied, thanks!

[1/1] memory: renesas-rpc-if: fix platform-device leak in error path
      commit: b452dbf24d7d9a990d70118462925f6ee287d135

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

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

end of thread, other threads:[~2022-04-04 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 18:06 [PATCH] memory: renesas-rpc-if: fix platform-device leak in error path Johan Hovold
2022-03-18 12:53 ` Krzysztof Kozlowski
2022-04-04 17:08 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).