Skip to content

Commit

Permalink
blkcg: remove unnecessary NULL checks from __cfqg_set_weight_device()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
htejun authored and axboe committed Aug 18, 2015
1 parent 3a7faea commit 5332dfc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 5332dfc

Please sign in to comment.