]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
blkcg: remove unnecessary NULL checks from __cfqg_set_weight_device()
authorTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 21:55:27 +0000 (14:55 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 22:49:18 +0000 (15:49 -0700)
blkg_to_cfqg() and blkcg_to_cfqgd() on a valid blkg with the policy
enabled are guaranteed to return non-NULL and the counterpart in
blk-throttle doesn't have these checks either.  Remove the spurious
NULL checks.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/cfq-iosched.c

index 395476ab14fe8e1177e21578c826ee19e9103fa9..bcf40266bd0a617dbc4c3c3d550b2829defe6d40 100644 (file)
@@ -1752,12 +1752,10 @@ static ssize_t __cfqg_set_weight_device(struct kernfs_open_file *of,
        if (ret)
                return ret;
 
-       ret = -EINVAL;
        cfqg = blkg_to_cfqg(ctx.blkg);
        cfqgd = blkcg_to_cfqgd(blkcg);
-       if (!cfqg || !cfqgd)
-               goto err;
 
+       ret = -EINVAL;
        if (!ctx.v || (ctx.v >= CFQ_WEIGHT_MIN && ctx.v <= CFQ_WEIGHT_MAX)) {
                if (!is_leaf_weight) {
                        cfqg->dev_weight = ctx.v;
@@ -1769,7 +1767,6 @@ static ssize_t __cfqg_set_weight_device(struct kernfs_open_file *of,
                ret = 0;
        }
 
-err:
        blkg_conf_finish(&ctx);
        return ret ?: nbytes;
 }