Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6201171e authored by wanghaibin's avatar wanghaibin Committed by Tejun Heo
Browse files

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: default avatarwanghaibin <wanghaibin.wang@huawei.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 82607adc
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -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_cleanup(ctx);

	return ret;
	return 0;
}

/**