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:
Ming Lei 2025-05-05 22:17:56 +08:00 committed by Jens Axboe
parent a3dc6279c2
commit e25ee50dfa
1 changed files with 2 additions and 2 deletions

View File

@ -425,7 +425,7 @@ elv_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
e = container_of(kobj, struct elevator_queue, kobj); e = container_of(kobj, struct elevator_queue, kobj);
mutex_lock(&e->sysfs_lock); mutex_lock(&e->sysfs_lock);
error = e->type ? entry->show(e, page) : -ENOENT; error = entry->show(e, page);
mutex_unlock(&e->sysfs_lock); mutex_unlock(&e->sysfs_lock);
return error; return error;
} }
@ -443,7 +443,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,
e = container_of(kobj, struct elevator_queue, kobj); e = container_of(kobj, struct elevator_queue, kobj);
mutex_lock(&e->sysfs_lock); 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); mutex_unlock(&e->sysfs_lock);
return error; return error;
} }