Skip to content

Commit

Permalink
block: get rid of unnecessary local variable
Browse files Browse the repository at this point in the history
Since whole elevator register is protectd by sysfs_lock, we
don't need extras 'has_elevator'. Just use q->elevator directly.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Yufen Yu authored and axboe committed Oct 9, 2020
1 parent f0c6ae0 commit 0546858
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ int blk_register_queue(struct gendisk *disk)
int ret;
struct device *dev = disk_to_dev(disk);
struct request_queue *q = disk->queue;
bool has_elevator = false;

if (WARN_ON(!q))
return -ENXIO;
Expand Down Expand Up @@ -899,7 +898,6 @@ int blk_register_queue(struct gendisk *disk)
kobject_put(&dev->kobj);
return ret;
}
has_elevator = true;
}

blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
Expand All @@ -908,7 +906,7 @@ int blk_register_queue(struct gendisk *disk)

/* Now everything is ready and send out KOBJ_ADD uevent */
kobject_uevent(&q->kobj, KOBJ_ADD);
if (has_elevator)
if (q->elevator)
kobject_uevent(&q->elevator->kobj, KOBJ_ADD);
mutex_unlock(&q->sysfs_lock);

Expand Down

0 comments on commit 0546858

Please sign in to comment.