diff options
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r-- | block/blk-sysfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 54d0db116153..fc41d83be22b 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -276,9 +276,12 @@ int blk_register_queue(struct gendisk *disk) | |||
276 | 276 | ||
277 | struct request_queue *q = disk->queue; | 277 | struct request_queue *q = disk->queue; |
278 | 278 | ||
279 | if (!q || !q->request_fn) | 279 | if (WARN_ON(!q)) |
280 | return -ENXIO; | 280 | return -ENXIO; |
281 | 281 | ||
282 | if (!q->request_fn) | ||
283 | return 0; | ||
284 | |||
282 | ret = kobject_add(&q->kobj, kobject_get(&disk->dev.kobj), | 285 | ret = kobject_add(&q->kobj, kobject_get(&disk->dev.kobj), |
283 | "%s", "queue"); | 286 | "%s", "queue"); |
284 | if (ret < 0) | 287 | if (ret < 0) |
@@ -300,7 +303,10 @@ void blk_unregister_queue(struct gendisk *disk) | |||
300 | { | 303 | { |
301 | struct request_queue *q = disk->queue; | 304 | struct request_queue *q = disk->queue; |
302 | 305 | ||
303 | if (q && q->request_fn) { | 306 | if (WARN_ON(!q)) |
307 | return; | ||
308 | |||
309 | if (q->request_fn) { | ||
304 | elv_unregister_queue(q); | 310 | elv_unregister_queue(q); |
305 | 311 | ||
306 | kobject_uevent(&q->kobj, KOBJ_REMOVE); | 312 | kobject_uevent(&q->kobj, KOBJ_REMOVE); |