Skip to content
/ linux Public

Commit a028adb

Browse files
Haoxiang LiSasha Levin
authored andcommitted
parisc: kernel: replace kfree() with put_device() in create_tree_node()
[ Upstream commit dcf6959 ] If device_register() fails, put_device() is the correct way to drop the device reference. Found by code review. Fixes: 1070c96 ("[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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 943ed56 commit a028adb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/parisc/kernel/drivers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ struct parisc_device * __init create_tree_node(char id, struct device *parent)
434434
dev->dev.dma_mask = &dev->dma_mask;
435435
dev->dev.coherent_dma_mask = dev->dma_mask;
436436
if (device_register(&dev->dev)) {
437-
kfree(dev);
437+
put_device(&dev->dev);
438438
return NULL;
439439
}
440440

0 commit comments

Comments
 (0)