summaryrefslogtreecommitdiff
path: root/block/blk-sysfs.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-01-24 13:59:36 -0800
committerJens Axboe <axboe@kernel.dk>2022-02-28 06:40:23 -0700
commitf5ec592dd3bcf7c91f7c262a7f5011e001d269cd (patch)
tree4907b114a9e1fd2a3e4c05855fffc75ca2010d7e /block/blk-sysfs.c
parent483546c11d702fd6f74c8c3f8123b7672def10b2 (diff)
downloadlwn-f5ec592dd3bcf7c91f7c262a7f5011e001d269cd.tar.gz
lwn-f5ec592dd3bcf7c91f7c262a7f5011e001d269cd.zip
block: simplify calling convention of elv_unregister_queue()
Make elv_unregister_queue() a no-op if q->elevator is NULL or is not registered. This simplifies the existing callers, as well as the future caller in the error path of blk_register_queue(). Also don't bother checking whether q is NULL, since it never is. Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220124215938.2769-2-ebiggers@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 4c6b7dff71e5..49854c7ea29b 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -960,8 +960,7 @@ void blk_unregister_queue(struct gendisk *disk)
blk_trace_remove_sysfs(disk_to_dev(disk));
mutex_lock(&q->sysfs_lock);
- if (q->elevator)
- elv_unregister_queue(q);
+ elv_unregister_queue(q);
disk_unregister_independent_access_ranges(disk);
mutex_unlock(&q->sysfs_lock);
mutex_unlock(&q->sysfs_dir_lock);