> -----Original Message----- > From: linux-block-owner@xxxxxxxxxxxxxxx [mailto:linux-block- > owner@xxxxxxxxxxxxxxx] On Behalf Of markus@xxxxxxxxxxxxxxx > Sent: Saturday, May 06, 2017 12:23 AM > To: Bart Van Assche <Bart.VanAssche@xxxxxxxxxxx> > Cc: linux-block@xxxxxxxxxxxxxxx; axboe@xxxxxxxxx > Subject: [PATCH] block: Remove leading whitespace and trailing > newline in elevator switch error message > > > Trying to switch to a non-existing elevator currently results in > garbled > dmesg output, e.g.: > > # echo " foo" > /sys/block/sda/queue/scheduler > > elevator: type foo not found > elevator: switch to foo > failed ... > @@ -1063,15 +1062,14 @@ static int __elevator_change(struct > request_queue *q, const char *name) > if (q->mq_ops && !strncmp(name, "none", 4)) > return elevator_switch(q, NULL); > > - strlcpy(elevator_name, name, sizeof(elevator_name)); > - e = elevator_get(strstrip(elevator_name), true); > + e = elevator_get(name, true); > if (!e) { > - printk(KERN_ERR "elevator: type %s not found\n", > elevator_name); > + printk(KERN_ERR "elevator: type %s not found\n", name); > return -EINVAL; > } ... > @@ -1112,16 +1110,19 @@ static inline bool elv_support_iosched(struct > request_queue *q) > ssize_t elv_iosched_store(struct request_queue *q, const char *name, > size_t count) > { ... > + strlcpy(elevator_name, skip_spaces(name), > sizeof(elevator_name)); > + strstrip(elevator_name); > + ret = __elevator_change(q, elevator_name); > if (!ret) > return count; > > - printk(KERN_ERR "elevator: switch to %s failed\n", name); > + printk(KERN_ERR "elevator: switch to %s failed\n", > elevator_name); > return ret; > } That leaves two lines of error prints for a single error, and the second line doesn't convey additional information.