drivers/misc/rp1/rp1_pci.c | 3 +++ 1 file changed, 3 insertions(+)
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
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
© 2016 - 2025 Red Hat, Inc.