We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 46a7db4 commit ec28fccCopy full SHA for ec28fcc
drivers/block/floppy.c
@@ -4528,10 +4528,19 @@ static void floppy_probe(dev_t dev)
4528
return;
4529
4530
mutex_lock(&floppy_probe_lock);
4531
- if (!disks[drive][type]) {
4532
- if (floppy_alloc_disk(drive, type) == 0)
4533
- add_disk(disks[drive][type]);
4534
- }
+ if (disks[drive][type])
+ goto out;
+ if (floppy_alloc_disk(drive, type))
4535
+ if (add_disk(disks[drive][type]))
4536
+ goto cleanup_disk;
4537
+out:
4538
+ mutex_unlock(&floppy_probe_lock);
4539
+ return;
4540
+
4541
+cleanup_disk:
4542
+ blk_cleanup_disk(disks[drive][type]);
4543
+ disks[drive][type] = NULL;
4544
mutex_unlock(&floppy_probe_lock);
4545
}
4546
0 commit comments