From: Xu Yang Date: Fri, 17 Mar 2023 06:15:15 +0000 (+0800) Subject: usb: chipdea: core: fix return -EINVAL if request role is the same with current role X-Git-Tag: baikal/mips/sdk5.8.2~57 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=d72097ebb927a7c1b68cfccdfc2c9779761be2bf;p=kernel.git 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: 6077caa77c13 ("usb: chipidea: core: add sysfs group") cc: Acked-by: Peter Chen Signed-off-by: Xu Yang Link: https://lore.kernel.org/r/20230317061516.2451728-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 74cdc7ef476ae..6e7da8c1cf5cc 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -960,9 +960,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);