Commit 3670de80 authored by Xu Yang's avatar Xu Yang Committed by Greg Kroah-Hartman
Browse files

usb: chipdea: core: fix return -EINVAL if request role is the same with current role



It should not return -EINVAL if the request role is the same with current
role, return non-error and without do anything instead.

Fixes: a932a804 ("usb: chipidea: core: add sysfs group")
cc: <stable@vger.kernel.org>
Acked-by: default avatarPeter Chen <peter.chen@kernel.org>
Signed-off-by: default avatarXu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20230317061516.2451728-1-xu.yang_2@nxp.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bbefb7ed
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -984,9 +984,12 @@ static ssize_t role_store(struct device *dev,
			     strlen(ci->roles[role]->name)))
			break;

	if (role == CI_ROLE_END || role == ci->role)
	if (role == CI_ROLE_END)
		return -EINVAL;

	if (role == ci->role)
		return n;

	pm_runtime_get_sync(dev);
	disable_irq(ci->irq);
	ci_role_stop(ci);