From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:26:38 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 block/cfq-iosched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c73a6fcaeb9d..454297fe8fd6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1788,9 +1788,10 @@ static ssize_t __cfqg_set_weight_device(struct 
kernfs_open_file *of,
 
        if (sscanf(ctx.body, "%llu", &v) == 1) {
                /* require "default" on dfl */
-               ret = -ERANGE;
-               if (!v && on_dfl)
+               if (!v && on_dfl) {
+                       ret = -ERANGE;
                        goto out_finish;
+               }
        } else if (!strcmp(strim(ctx.body), "default")) {
                v = 0;
        } else {
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to