summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorwanghaibin <wanghaibin.wang@huawei.com>2016-01-07 20:38:59 +0800
committerTejun Heo <tj@kernel.org>2016-01-07 11:04:34 -0500
commit6201171e3b2c02992e62448636631a0dfe4e9d20 (patch)
tree4f930c7f753879548d0baf776f3439056ed0fc01 /kernel/workqueue.c
parent82607adcf9cdf40fb7b5331269780c8f70ec6e35 (diff)
downloadlinux-6201171e3b2c02992e62448636631a0dfe4e9d20.tar.gz
linux-6201171e3b2c02992e62448636631a0dfe4e9d20.tar.xz
workqueue: simplify the apply_workqueue_attrs_locked()
If the apply_wqattrs_prepare() returns NULL, it has already cleaned up the related resources, so it can return directly and avoid calling the clean up function again. This doesn't introduce any functional changes. Signed-off-by: wanghaibin <wanghaibin.wang@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1ecb588aae07..61a0264e28f9 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3651,7 +3651,6 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
const struct workqueue_attrs *attrs)
{
struct apply_wqattrs_ctx *ctx;
- int ret = -ENOMEM;
/* only unbound workqueues can change attributes */
if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
@@ -3662,16 +3661,14 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
return -EINVAL;
ctx = apply_wqattrs_prepare(wq, attrs);
+ if (!ctx)
+ return -ENOMEM;
/* the ctx has been prepared successfully, let's commit it */
- if (ctx) {
- apply_wqattrs_commit(ctx);
- ret = 0;
- }
-
+ apply_wqattrs_commit(ctx);
apply_wqattrs_cleanup(ctx);
- return ret;
+ return 0;
}
/**