summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/elevator.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 23cfbe528be..e58928e809e 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -155,9 +155,10 @@ static void elevator_setup_default(void)
/*
* If the given scheduler is not available, fall back to no-op.
*/
- if (!(e = elevator_find(chosen_elevator)))
+ if ((e = elevator_find(chosen_elevator)))
+ elevator_put(e);
+ else
strcpy(chosen_elevator, "noop");
- elevator_put(e);
}
static int __init elevator_setup(char *str)