From: Omar Sandoval Date: Thu, 4 May 2017 07:31:26 +0000 (-0700) Subject: blk-mq-debugfs: don't open code strstrip() X-Git-Tag: MMI-PSA29.97-13-9~5662^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=71b90511cb170dd3e13b640cc1a453b2dd92e023;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git blk-mq-debugfs: don't open code strstrip() Slightly more readable, plus we also strip leading spaces. Signed-off-by: Omar Sandoval Reviewed-by: Hannes Reinecke Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 2a19237455d4..109ae9f3d400 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -111,17 +111,16 @@ static ssize_t blk_queue_flags_store(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct request_queue *q = file_inode(file)->i_private; - char op[16] = { }, *s; + char opbuf[16] = { }, *op; - if (count >= sizeof(op)) { + if (count >= sizeof(opbuf)) { pr_err("%s: operation too long\n", __func__); goto inval; } - if (copy_from_user(op, buf, count)) + if (copy_from_user(opbuf, buf, count)) return -EFAULT; - s = op; - strsep(&s, " \t\n"); /* strip trailing whitespace */ + op = strstrip(opbuf); if (strcmp(op, "run") == 0) { blk_mq_run_hw_queues(q, true); } else if (strcmp(op, "start") == 0) {