* [PATCH v3] misc: rp1: Fix an error handling path in rp1_probe()
@ 2025-11-08 7:14 Christophe JAILLET
2025-11-10 11:02 ` Andrea della Porta
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-11-08 7:14 UTC (permalink / raw)
To: krzk, Andrea della Porta, Arnd Bergmann, Greg Kroah-Hartman,
Florian Fainelli, Bjorn Helgaas
Cc: linux-kernel, kernel-janitors, Christophe JAILLET
When DT is used to get the reference of 'rp1_node', it should be released
when not needed anymore, otherwise it is leaking.
In such a case, add the missing of_node_put() call at the end of the probe,
as already done in the error handling path.
Fixes: 49d63971f963 ("misc: rp1: RaspberryPi RP1 misc driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is compile tested only.
Changes in v3:
- Don't use cleanup.h in this case [Krzysztof Kozlowski]
Changes in v2:
- implement Dan's suggestions [Dan Carpenter]
v2: https://lore.kernel.org/lkml/8f55f8866a6680830c9d318201a29293ac50a591.1761334487.git.christophe.jaillet@wanadoo.fr/
v1: https://lore.kernel.org/lkml/4e92a271fdb98560c4e659556a1f3e99e7d0d38e.1760987458.git.christophe.jaillet@wanadoo.fr/
---
drivers/misc/rp1/rp1_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c
index 803832006ec8..a342bcc6164b 100644
--- a/drivers/misc/rp1/rp1_pci.c
+++ b/drivers/misc/rp1/rp1_pci.c
@@ -289,6 +289,9 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_unload_overlay;
}
+ if (skip_ovl)
+ of_node_put(rp1_node);
+
return 0;
err_unload_overlay:
--
2.51.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] misc: rp1: Fix an error handling path in rp1_probe()
2025-11-08 7:14 [PATCH v3] misc: rp1: Fix an error handling path in rp1_probe() Christophe JAILLET
@ 2025-11-10 11:02 ` Andrea della Porta
0 siblings, 0 replies; 2+ messages in thread
From: Andrea della Porta @ 2025-11-10 11:02 UTC (permalink / raw)
To: Christophe JAILLET
Cc: krzk, Andrea della Porta, Arnd Bergmann, Greg Kroah-Hartman,
Florian Fainelli, Bjorn Helgaas, linux-kernel, kernel-janitors
Hi Christophe,
On 08:14 Sat 08 Nov , Christophe JAILLET wrote:
> When DT is used to get the reference of 'rp1_node', it should be released
> when not needed anymore, otherwise it is leaking.
>
> In such a case, add the missing of_node_put() call at the end of the probe,
> as already done in the error handling path.
>
> Fixes: 49d63971f963 ("misc: rp1: RaspberryPi RP1 misc driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is compile tested only.
>
> Changes in v3:
> - Don't use cleanup.h in this case [Krzysztof Kozlowski]
>
> Changes in v2:
> - implement Dan's suggestions [Dan Carpenter]
> v2: https://lore.kernel.org/lkml/8f55f8866a6680830c9d318201a29293ac50a591.1761334487.git.christophe.jaillet@wanadoo.fr/
>
> v1: https://lore.kernel.org/lkml/4e92a271fdb98560c4e659556a1f3e99e7d0d38e.1760987458.git.christophe.jaillet@wanadoo.fr/
> ---
> drivers/misc/rp1/rp1_pci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c
> index 803832006ec8..a342bcc6164b 100644
> --- a/drivers/misc/rp1/rp1_pci.c
> +++ b/drivers/misc/rp1/rp1_pci.c
> @@ -289,6 +289,9 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> goto err_unload_overlay;
> }
>
> + if (skip_ovl)
> + of_node_put(rp1_node);
> +
> return 0;
>
> err_unload_overlay:
> --
> 2.51.1
>
Reviewed-by: Andrea della Porta <andrea.porta@suse.com>
Thanks!
Andrea
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-10 10:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-08 7:14 [PATCH v3] misc: rp1: Fix an error handling path in rp1_probe() Christophe JAILLET
2025-11-10 11:02 ` Andrea della Porta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox