Revert "floppy: fix reference leak on platform_device_register() failure"

This reverts commit e784f2ea0b.

Jiri says the patch is buggy, and it looks like he is right revert it
for now.

Link: https://lore.kernel.org/linux-block/897f442d-4e04-4b70-b716-38fd10b8af36@kernel.org/
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2026-04-23 05:06:43 -06:00
parent 309e02dccf
commit 895a9b3791

View File

@ -4722,19 +4722,15 @@ static int __init do_floppy_init(void)
floppy_device[drive].dev.groups = floppy_dev_groups;
err = platform_device_register(&floppy_device[drive]);
if (err) {
platform_device_put(&floppy_device[drive]);
if (err)
goto out_remove_drives;
}
registered[drive] = true;
err = device_add_disk(&floppy_device[drive].dev,
disks[drive][0], NULL);
if (err) {
platform_device_unregister(&floppy_device[drive]);
registered[drive] = false;
if (err)
goto out_remove_drives;
}
}
return 0;