From: Peter Chen <peter.chen@nxp.com>
To: Tang Bin <tangbin@cmss.chinamobile.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>,
Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: Re: [PATCH] usb: hcd: fix the error check
Date: Mon, 24 Aug 2020 02:39:50 +0000 [thread overview]
Message-ID: <20200824023839.GA4974@b29397-desktop> (raw)
In-Reply-To: <20200820122038.18704-1-tangbin@cmss.chinamobile.com>
On 20-08-20 20:20:38, Tang Bin wrote:
> In the function usb_add_hcd(), usb_phy_roothub_alloc()
> can return NULL in some cases, so IS_ERR() doesn't meet
> the requirements. Thus fix it.
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> drivers/usb/core/hcd.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index aa45840d8..b73a92ee1 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -2633,8 +2633,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
>
> if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
> hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
> - if (IS_ERR(hcd->phy_roothub))
> - return PTR_ERR(hcd->phy_roothub);
> + if (IS_ERR_OR_NULL(hcd->phy_roothub))
> + return hcd->phy_roothub ?
> + PTR_ERR(hcd->phy_roothub) : -ENODEV;
Many (old) host controller drivers, their PHYs are not seen by software.
We may not consider NULL as error.
--
Thanks,
Peter Chen
prev parent reply other threads:[~2020-08-24 2:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 12:20 [PATCH] usb: hcd: fix the error check Tang Bin
2020-08-21 23:25 ` [usb] 33958ef53b: kmsg.ehci-pci#:#:#a.#:init#:#:#a.#fail kernel test robot
2020-08-24 2:39 ` 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=20200824023839.GA4974@b29397-desktop \
--to=peter.chen@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.com \
--cc=zhangshengju@cmss.chinamobile.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