mirror of https://github.com/torvalds/linux.git
block: remove elevator queue's type check in elv_attr_show/store()
elevatore queue's type is assigned since its allocation, and never get cleared until it is released. So its ->type is always not NULL, remove the unnecessary check. Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com> Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250505141805.2751237-19-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a3dc6279c2
commit
e25ee50dfa
|
|
@ -425,7 +425,7 @@ elv_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
|
|||
|
||||
e = container_of(kobj, struct elevator_queue, kobj);
|
||||
mutex_lock(&e->sysfs_lock);
|
||||
error = e->type ? entry->show(e, page) : -ENOENT;
|
||||
error = entry->show(e, page);
|
||||
mutex_unlock(&e->sysfs_lock);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -443,7 +443,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,
|
|||
|
||||
e = container_of(kobj, struct elevator_queue, kobj);
|
||||
mutex_lock(&e->sysfs_lock);
|
||||
error = e->type ? entry->store(e, page, length) : -ENOENT;
|
||||
error = entry->store(e, page, length);
|
||||
mutex_unlock(&e->sysfs_lock);
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue