lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210507070843.GG1955@kadam>
Date:   Fri, 7 May 2021 10:08:43 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Chunfeng Yun <chunfeng.yun@...iatek.com>
Cc:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        gregkh@...uxfoundation.org, shubhankarvk@...il.com,
        lee.jones@...aro.org, gustavoars@...nel.org, vulab@...as.ac.cn,
        john453@...aday-tech.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] usb: fotg210-hcd: Fix an error message

On Fri, May 07, 2021 at 10:20:30AM +0800, Chunfeng Yun wrote:
> 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@...adoo.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.

Then the error message would print misleading information.  The
usb_create_hcd() does not return -ENOMEM, it returns NULL.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ