Skip to content

Commit 895a9b3

Browse files
committed
Revert "floppy: fix reference leak on platform_device_register() failure"
This reverts commit e784f2e. Jiri says the patch is buggy, and it looks like he is right revert it for now. Link: https://lore.kernel.org/linux-block/[email protected]/ Reported-by: Jiri Slaby <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 309e02d commit 895a9b3

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

drivers/block/floppy.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4722,19 +4722,15 @@ static int __init do_floppy_init(void)
47224722
floppy_device[drive].dev.groups = floppy_dev_groups;
47234723

47244724
err = platform_device_register(&floppy_device[drive]);
4725-
if (err) {
4726-
platform_device_put(&floppy_device[drive]);
4725+
if (err)
47274726
goto out_remove_drives;
4728-
}
4727+
47294728
registered[drive] = true;
47304729

47314730
err = device_add_disk(&floppy_device[drive].dev,
47324731
disks[drive][0], NULL);
4733-
if (err) {
4734-
platform_device_unregister(&floppy_device[drive]);
4735-
registered[drive] = false;
4732+
if (err)
47364733
goto out_remove_drives;
4737-
}
47384734
}
47394735

47404736
return 0;

0 commit comments

Comments
 (0)