Linux USB
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Yuan Fang <fangyuanseu@gmail.com>, linux-usb@vger.kernel.org
Cc: Yuan Fang <yuan.fang@verisilicon.com>
Subject: Re: [PATCH] driver/usb/dwc3: Add error handle for dwc3 get usb phy
Date: Thu, 10 Jun 2021 14:47:03 +0300	[thread overview]
Message-ID: <87bl8e0wnc.fsf@kernel.org> (raw)
In-Reply-To: <20210610113745.7710-1-yuan.fang@verisilicon.com>

[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]


Hi,

Yuan Fang <fangyuanseu@gmail.com> writes:

> Add error handle for dwc3 core get usb phy, because
> without error handle will lead to bug.
>
> consider case like this, when both dwc->usb2_phy/usb3_phy
> and dwc->usb2_generic_phy/usb3_generic_phy do not exist
> current driver code set them all to NULL and return 0
> to caller which means usb phy is ready.

it's unclear what the problem is. Care to describe what's happening?

> Signed-off-by: Yuan Fang <yuan.fang@verisilicon.com>
> ---
> Hi maintainer,
>
>    I find this issue when i try to add a new usb phy driver for
>    dwc3 usb core, this issue looks like a bug, please kindly have
>    a review, many thanks.
>
> Best regards,
> Yuan Fang
>
>  drivers/usb/dwc3/core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index b6e53d8212cd..4d527d313a4c 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1184,6 +1184,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
>  		ret = PTR_ERR(dwc->usb3_generic_phy);
>  		if (ret == -ENOSYS || ret == -ENODEV) {
>  			dwc->usb3_generic_phy = NULL;
> +			return dev_err_probe(dev, ret, "no usb phy device\n");

no, this is incorrect. Some platforms don't require a PHY driver at
all because there's no SW control for the PHY.

Moreover, generic PHY framework protects against NULL phy. I don't see
what the problem you're referring to is here.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

  reply	other threads:[~2021-06-10 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 11:37 [PATCH] driver/usb/dwc3: Add error handle for dwc3 get usb phy Yuan Fang
2021-06-10 11:47 ` Felipe Balbi [this message]
2021-06-10 11:58   ` 答复: " Fang, Yuan
2021-06-10 12:27     ` Felipe Balbi
2021-06-10 12:08   ` Fang, Yuan

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=87bl8e0wnc.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=fangyuanseu@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=yuan.fang@verisilicon.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