diff options
author | Xu Yang <xu.yang_2@nxp.com> | 2023-03-17 09:15:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-04-05 12:14:18 +0300 |
commit | 377b6102e408cb8b869e89bc9dde8d3ae5fe28ce (patch) | |
tree | 9a9d9c9034ae3bae76a98aa928788b3cc58a7382 /drivers/usb | |
parent | 0dabb72b923e17cb3b4ac99ea1adc9ef35116930 (diff) | |
download | linux-377b6102e408cb8b869e89bc9dde8d3ae5fe28ce.tar.xz |
usb: chipdea: core: fix return -EINVAL if request role is the same with current role
commit 3670de80678961eda7fa2220883fc77c16868951 upstream.
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/chipidea/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 7142baf654bc..cb9d19382b3e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -875,9 +875,12 @@ static ssize_t ci_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); |