-
Patrick Mochel authored
alloc_disk() should set the kobject's subsystem before calling kobject_init(), which would increment the subsystem's refcount (to be decremented in kobject_cleanup()). Since it was being set after the call, the subsystem's refcount was being pushed to 0 if the floppy driver was enabled, but there were no floppy drives found (the driver would alloc_disk(), then put_disk() if no drives were found). Partitions use kobject_register(), so they don't have to do kobject_init() (it's done for them). add_disk() should use kobject_add() instead of kobject_register(), since it's already done kobject_init() in alloc_disk(). Also, del_gendisk() doesn't have to do extra refcount and call kobject_unregister(); it should just call kobject_del(). The block device will be freed up later when put_disk() pushes the refcount to 0.
b26ca10f