public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <gregkh@linuxfoundation.org>, <shubhankarvk@gmail.com>,
	<lee.jones@linaro.org>, <gustavoars@kernel.org>,
	<vulab@iscas.ac.cn>, <john453@faraday-tech.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] usb: fotg210-hcd: Fix an error message
Date: Fri, 7 May 2021 10:20:30 +0800	[thread overview]
Message-ID: <1620354030.10796.6.camel@mhfsdcap03> (raw)
In-Reply-To: <94531bcff98e46d4f9c20183a90b7f47f699126c.1620333419.git.christophe.jaillet@wanadoo.fr>

On Thu, 2021-05-06 at 22:39 +0200, Christophe JAILLET wrote:
> 'retval' is known to be -ENODEV here.
> This is a hard-coded default error code which is not useful in the error
> message. Moreover, another error message is printed at the end of the
> error handling path. The corresponding error code (-ENOMEM) is more
> informative.
> 
> So remove simplify the first error message.
> 
> While at it, also remove the useless initialization of 'retval'.
> 
> Fixes: 7d50195f6c50 ("usb: host: Faraday fotg210-hcd driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/usb/host/fotg210-hcd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 6cac642520fc..9c2eda0918e1 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -5568,7 +5568,7 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
>  	struct usb_hcd *hcd;
>  	struct resource *res;
>  	int irq;
> -	int retval = -ENODEV;
> +	int retval;
>  	struct fotg210_hcd *fotg210;
>  
>  	if (usb_disabled())
> @@ -5588,7 +5588,7 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
>  	hcd = usb_create_hcd(&fotg210_fotg210_hc_driver, dev,
>  			dev_name(dev));
>  	if (!hcd) {
> -		dev_err(dev, "failed to create hcd with err %d\n", retval);
> +		dev_err(dev, "failed to create hcd\n");
>  		retval = -ENOMEM;
How about moving this line before dev_err()? then could keep error log
unchanged.

>  		goto fail_create_hcd;
>  	}


  reply	other threads:[~2021-05-07  2:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 20:39 [PATCH] usb: fotg210-hcd: Fix an error message Christophe JAILLET
2021-05-07  2:20 ` Chunfeng Yun [this message]
2021-05-07  7:06   ` Christophe JAILLET
2021-05-08  1:26     ` Chunfeng Yun
2021-05-07  7:08   ` Dan Carpenter

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=1620354030.10796.6.camel@mhfsdcap03 \
    --to=chunfeng.yun@mediatek.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=john453@faraday-tech.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shubhankarvk@gmail.com \
    --cc=vulab@iscas.ac.cn \
    /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