From: Peter Chen <peter.chen@nxp.com>
To: Pawel Laszczak <pawell@cadence.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"balbi@kernel.org" <balbi@kernel.org>,
"rogerq@ti.com" <rogerq@ti.com>,
"weiyongjun1@huawei.com" <weiyongjun1@huawei.com>,
"jpawar@cadence.com" <jpawar@cadence.com>,
"kurahul@cadence.com" <kurahul@cadence.com>,
"sparmar@cadence.com" <sparmar@cadence.com>
Subject: Re: [PATCH] usb: cdns3: Removes duplicated call to the cdns3_exit_roles function
Date: Thu, 13 Aug 2020 09:25:20 +0000 [thread overview]
Message-ID: <20200813092429.GA22195@b29397-desktop> (raw)
In-Reply-To: <20200813071054.25837-1-pawell@cadence.com>
On 20-08-13 09:10:54, Pawel Laszczak wrote:
> To avoid double calling of function cdns3_exit_roles when initialization
> failed
need ","
> 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.
If you delete the cdns3_exit_roles here, where it will be called again?
I only see cdns3_exit_roles is called at .remove callback.
Peter
>
> Signed-off-by: Pawel Laszczak <pawell@cadence.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
>
--
Thanks,
Peter Chen
prev parent reply other threads:[~2020-08-13 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 7:10 [PATCH] usb: cdns3: Removes duplicated call to the cdns3_exit_roles function Pawel Laszczak
2020-08-13 9:25 ` Peter Chen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200813092429.GA22195@b29397-desktop \
--to=peter.chen@nxp.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jpawar@cadence.com \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=rogerq@ti.com \
--cc=sparmar@cadence.com \
--cc=weiyongjun1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox