parisc: kernel: replace kfree() with put_device() in create_tree_node()

If device_register() fails, put_device() is the correct way to
drop the device reference.

Found by code review.

Fixes: 1070c9655b ("[PA-RISC] Fix must_check warnings in drivers.c")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Haoxiang Li
2025-12-19 21:19:26 +08:00
committed by Helge Deller
parent 8f0b4cce44
commit dcf69599c4

View File

@@ -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;
}