[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200813071054.25837-1-pawell@cadence.com>
Date: Thu, 13 Aug 2020 09:10:54 +0200
From: Pawel Laszczak <pawell@...ence.com>
To: <gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <balbi@...nel.org>
CC: <rogerq@...com>, <peter.chen@....com>, <weiyongjun1@...wei.com>,
<jpawar@...ence.com>, <kurahul@...ence.com>, <sparmar@...ence.com>,
Pawel Laszczak <pawell@...ence.com>
Subject: [PATCH] usb: cdns3: Removes duplicated call to the cdns3_exit_roles function
To avoid double calling of function cdns3_exit_roles when initialization
failed patch removes invoking this function from cdns3_core_init_role.
This function is invoked again from cdns3_probe when
cdns3_core_init_role returns error code.
Signed-off-by: Pawel Laszczak <pawell@...ence.com>
---
drivers/usb/cdns3/core.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index 5c1586ec7824..c22c7224642a 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -132,7 +132,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
if (ret) {
dev_err(dev, "Host initialization failed with %d\n",
ret);
- goto err;
+ return ret;
}
}
@@ -141,7 +141,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
if (ret) {
dev_err(dev, "Device initialization failed with %d\n",
ret);
- goto err;
+ return ret;
}
}
@@ -149,38 +149,34 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
ret = cdns3_drd_update_mode(cdns);
if (ret)
- goto err;
+ return ret;
/* Initialize idle role to start with */
ret = cdns3_role_start(cdns, USB_ROLE_NONE);
if (ret)
- goto err;
+ return ret;
switch (cdns->dr_mode) {
case USB_DR_MODE_OTG:
ret = cdns3_hw_role_switch(cdns);
if (ret)
- goto err;
+ return ret;
break;
case USB_DR_MODE_PERIPHERAL:
ret = cdns3_role_start(cdns, USB_ROLE_DEVICE);
if (ret)
- goto err;
+ return ret;
break;
case USB_DR_MODE_HOST:
ret = cdns3_role_start(cdns, USB_ROLE_HOST);
if (ret)
- goto err;
+ return ret;
break;
default:
- ret = -EINVAL;
- goto err;
+ return -EINVAL;
}
return 0;
-err:
- cdns3_exit_roles(cdns);
- return ret;
}
/**
--
2.17.1
Powered by blists - more mailing lists