Skip to content
/ linux Public

Commit 2f33f77

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 bd435f4 commit 2f33f77

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
@@ -435,7 +435,7 @@ static struct parisc_device * __init create_tree_node(char id,
435435
dev->dev.dma_mask = &dev->dma_mask;
436436
dev->dev.coherent_dma_mask = dev->dma_mask;
437437
if (device_register(&dev->dev)) {
438-
kfree(dev);
438+
put_device(&dev->dev);
439439
return NULL;
440440
}
441441

0 commit comments

Comments
 (0)