diff options
-rw-r--r-- | drivers/block/ub.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 8eb44a55b9b8..cfb824d90c86 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -2314,7 +2314,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2314 | goto err_id; | 2314 | goto err_id; |
2315 | 2315 | ||
2316 | lun->udev = sc; | 2316 | lun->udev = sc; |
2317 | list_add(&lun->link, &sc->luns); | ||
2318 | 2317 | ||
2319 | snprintf(lun->name, 16, DRV_NAME "%c(%d.%d.%d)", | 2318 | snprintf(lun->name, 16, DRV_NAME "%c(%d.%d.%d)", |
2320 | lun->id + 'a', sc->dev->bus->busnum, sc->dev->devnum, lun->num); | 2319 | lun->id + 'a', sc->dev->bus->busnum, sc->dev->devnum, lun->num); |
@@ -2327,7 +2326,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2327 | if ((disk = alloc_disk(UB_PARTS_PER_LUN)) == NULL) | 2326 | if ((disk = alloc_disk(UB_PARTS_PER_LUN)) == NULL) |
2328 | goto err_diskalloc; | 2327 | goto err_diskalloc; |
2329 | 2328 | ||
2330 | lun->disk = disk; | ||
2331 | sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a'); | 2329 | sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a'); |
2332 | sprintf(disk->devfs_name, DEVFS_NAME "/%c", lun->id + 'a'); | 2330 | sprintf(disk->devfs_name, DEVFS_NAME "/%c", lun->id + 'a'); |
2333 | disk->major = UB_MAJOR; | 2331 | disk->major = UB_MAJOR; |
@@ -2349,7 +2347,9 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2349 | blk_queue_max_sectors(q, UB_MAX_SECTORS); | 2347 | blk_queue_max_sectors(q, UB_MAX_SECTORS); |
2350 | blk_queue_hardsect_size(q, lun->capacity.bsize); | 2348 | blk_queue_hardsect_size(q, lun->capacity.bsize); |
2351 | 2349 | ||
2350 | lun->disk = disk; | ||
2352 | q->queuedata = lun; | 2351 | q->queuedata = lun; |
2352 | list_add(&lun->link, &sc->luns); | ||
2353 | 2353 | ||
2354 | set_capacity(disk, lun->capacity.nsec); | 2354 | set_capacity(disk, lun->capacity.nsec); |
2355 | if (lun->removable) | 2355 | if (lun->removable) |
@@ -2362,7 +2362,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2362 | err_blkqinit: | 2362 | err_blkqinit: |
2363 | put_disk(disk); | 2363 | put_disk(disk); |
2364 | err_diskalloc: | 2364 | err_diskalloc: |
2365 | list_del(&lun->link); | ||
2366 | ub_id_put(lun->id); | 2365 | ub_id_put(lun->id); |
2367 | err_id: | 2366 | err_id: |
2368 | kfree(lun); | 2367 | kfree(lun); |
@@ -2375,7 +2374,6 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2375 | struct ub_dev *sc = usb_get_intfdata(intf); | 2374 | struct ub_dev *sc = usb_get_intfdata(intf); |
2376 | struct list_head *p; | 2375 | struct list_head *p; |
2377 | struct ub_lun *lun; | 2376 | struct ub_lun *lun; |
2378 | struct gendisk *disk; | ||
2379 | unsigned long flags; | 2377 | unsigned long flags; |
2380 | 2378 | ||
2381 | /* | 2379 | /* |
@@ -2431,9 +2429,7 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2431 | */ | 2429 | */ |
2432 | list_for_each (p, &sc->luns) { | 2430 | list_for_each (p, &sc->luns) { |
2433 | lun = list_entry(p, struct ub_lun, link); | 2431 | lun = list_entry(p, struct ub_lun, link); |
2434 | disk = lun->disk; | 2432 | del_gendisk(lun->disk); |
2435 | if (disk->flags & GENHD_FL_UP) | ||
2436 | del_gendisk(disk); | ||
2437 | /* | 2433 | /* |
2438 | * I wish I could do: | 2434 | * I wish I could do: |
2439 | * set_bit(QUEUE_FLAG_DEAD, &q->queue_flags); | 2435 | * set_bit(QUEUE_FLAG_DEAD, &q->queue_flags); |