summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Yang <xu.yang_2@nxp.com>2023-03-17 14:15:15 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-23 18:17:32 +0100
commit3670de80678961eda7fa2220883fc77c16868951 (patch)
tree314d265182b20e44c4748b289aa9a9ccce1ced2c
parentbbefb7ed83e639ba1633e807f56b38a71c51fda3 (diff)
downloadlinux-stable-3670de80678961eda7fa2220883fc77c16868951.tar.gz
linux-stable-3670de80678961eda7fa2220883fc77c16868951.tar.bz2
linux-stable-3670de80678961eda7fa2220883fc77c16868951.zip
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: a932a8041ff9 ("usb: chipidea: core: add sysfs group") cc: <stable@vger.kernel.org> Acked-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Link: https://lore.kernel.org/r/20230317061516.2451728-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/chipidea/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 27c601296130..b6f2a41de20e 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -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);