Skip to content

Commit b603cd9

Browse files
author
Ming Lei
committed
block: remove elevator queue's type check in elv_attr_show/store()
JIRA: https://issues.redhat.com/browse/RHEL-112997 commit e25ee50 Author: Ming Lei <[email protected]> Date: Mon May 5 22:17:56 2025 +0800 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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Nilay Shroff <[email protected]> Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Ming Lei <[email protected]>
1 parent bb0d09e commit b603cd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block/elevator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ elv_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
425425

426426
e = container_of(kobj, struct elevator_queue, kobj);
427427
mutex_lock(&e->sysfs_lock);
428-
error = e->type ? entry->show(e, page) : -ENOENT;
428+
error = entry->show(e, page);
429429
mutex_unlock(&e->sysfs_lock);
430430
return error;
431431
}
@@ -443,7 +443,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,
443443

444444
e = container_of(kobj, struct elevator_queue, kobj);
445445
mutex_lock(&e->sysfs_lock);
446-
error = e->type ? entry->store(e, page, length) : -ENOENT;
446+
error = entry->store(e, page, length);
447447
mutex_unlock(&e->sysfs_lock);
448448
return error;
449449
}

0 commit comments

Comments
 (0)