* [PATCH] parisc: kernel: replace kfree() with put_device() in create_tree_node()
@ 2025-12-19 13:19 Haoxiang Li
2025-12-19 22:31 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-12-19 13:19 UTC (permalink / raw)
To: James.Bottomley, deller, willy
Cc: linux-parisc, linux-kernel, Haoxiang Li, stable
If device_register() fails, put_device() is the correct way to
drop the device reference.
Found by code review.
Fixes: 1070c9655b90 ("[PA-RISC] Fix must_check warnings in drivers.c")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
arch/parisc/kernel/drivers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index 8d23fe42b0ce..809e3c171ad5 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -435,7 +435,7 @@ static struct parisc_device * __init create_tree_node(char id,
dev->dev.dma_mask = &dev->dma_mask;
dev->dev.coherent_dma_mask = dev->dma_mask;
if (device_register(&dev->dev)) {
- kfree(dev);
+ put_device(&dev->dev);
return NULL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] parisc: kernel: replace kfree() with put_device() in create_tree_node()
2025-12-19 13:19 [PATCH] parisc: kernel: replace kfree() with put_device() in create_tree_node() Haoxiang Li
@ 2025-12-19 22:31 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2025-12-19 22:31 UTC (permalink / raw)
To: Haoxiang Li, James.Bottomley, willy; +Cc: linux-parisc, linux-kernel, stable
On 12/19/25 14:19, Haoxiang Li wrote:
> If device_register() fails, put_device() is the correct way to
> drop the device reference.
>
> Found by code review.
>
> Fixes: 1070c9655b90 ("[PA-RISC] Fix must_check warnings in drivers.c")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> arch/parisc/kernel/drivers.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to parisc git tree.
Thanks!
Helge
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-19 22:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 13:19 [PATCH] parisc: kernel: replace kfree() with put_device() in create_tree_node() Haoxiang Li
2025-12-19 22:31 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®