diff options
-rw-r--r-- | block/elevator.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/block/elevator.c b/block/elevator.c index 5b8fb8745e9a..61d5655a3819 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -751,16 +751,13 @@ static int elevator_change(struct request_queue *q, const char *elevator_name) return elevator_switch(q, NULL); } + if (q->elevator && elevator_match(q->elevator->type, elevator_name, 0)) + return 0; + e = elevator_get(q, elevator_name, true); if (!e) return -EINVAL; - if (q->elevator && - elevator_match(q->elevator->type, elevator_name, 0)) { - elevator_put(e); - return 0; - } - return elevator_switch(q, e); } |