elevator: fix unnecessary put of elevator in failure case
authorJens Axboe <axboe@fb.com>
Thu, 19 Jan 2017 14:10:13 +0000 (07:10 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 19 Jan 2017 14:43:05 +0000 (07:43 -0700)
We already checked that e is NULL, so no point in calling
elevator_put() to free it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: dc877dbd088f ("blk-mq-sched: add framework for MQ capable IO schedulers")
Signed-off-by: Jens Axboe <axboe@fb.com>
block/elevator.c

index bcba2dd5cb5c0812b76d2aaf2afff48ee0e207e6..ef7f59469acc7f313d3444545c9c5835efe81cc7 100644 (file)
@@ -230,10 +230,6 @@ int elevator_init(struct request_queue *q, char *name)
                        printk(KERN_ERR
                                "Default I/O scheduler not found. " \
                                "Using noop/none.\n");
-                       if (q->mq_ops) {
-                               elevator_put(e);
-                               return 0;
-                       }
                        e = elevator_get("noop", false);
                }
        }