mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fixup! net: usb: asix: propagate errors from MDIO accessors
Date: Fri, 2 Oct 2020 06:04:01 +0200	[thread overview]
Message-ID: <20201002040401.GM11648@pengutronix.de> (raw)
In-Reply-To: <20200930072456.28198-1-a.fatoum@pengutronix.de>

On Wed, Sep 30, 2020 at 09:24:57AM +0200, Ahmad Fatoum wrote:
> usb_control_msg doesn't (always) return 0 on success.
> Adjust the error checks to explicitly check for negative return values
> instead.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> Should probably be tested before applying. Sascha, can you easily do
> this?

I tested this and can confirm this patch fixes the breakage from the
last patch ;)

Sascha

> ---
>  drivers/net/usb/asix.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
> index fc7063095b6c..1140be9d1601 100644
> --- a/drivers/net/usb/asix.c
> +++ b/drivers/net/usb/asix.c
> @@ -255,15 +255,15 @@ static int asix_mdio_read(struct mii_bus *bus, int phy_id, int loc)
>  	int ret;
>  
>  	ret = asix_set_sw_mii(dev);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;
>  
>  	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (__u16)loc, 2, &res);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;
>  
>  	ret = asix_set_hw_mii(dev);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;
>  
>  	dev_dbg(&dev->edev.dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
> @@ -282,14 +282,18 @@ static int asix_mdio_write(struct mii_bus *bus, int phy_id, int loc, u16 val)
>  			phy_id, loc, val);
>  
>  	ret = asix_set_sw_mii(dev);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;
>  
>  	ret = asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;
>  
> -	return asix_set_hw_mii(dev);
> +	ret = asix_set_hw_mii(dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	return 0;
>  }
>  
>  static inline int asix_get_phy_addr(struct usbnet *dev)
> -- 
> 2.28.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-10-02  4:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30  7:19 [PATCH 01/12] hw_random: mxc-rngc: fix read of uninitialized variable Ahmad Fatoum
2020-09-30  7:19 ` [PATCH 02/12] globalvar: fix uninitialized read of variable when no nvvars exist Ahmad Fatoum
2020-09-30  7:19 ` [PATCH 03/12] commands: uimage: fix indeterminate exit code of command Ahmad Fatoum
2020-09-30  7:19 ` [PATCH 04/12] watchdog: fix division-by-zero when clock rate == 0 Ahmad Fatoum
2020-09-30  7:19 ` [PATCH 05/12] net: usb: asix: propagate errors from MDIO accessors Ahmad Fatoum
2020-09-30  7:24   ` [PATCH] fixup! " Ahmad Fatoum
2020-10-02  4:04     ` Sascha Hauer [this message]
2020-09-30  7:19 ` [PATCH 06/12] digest: sha: remove no-op "erase" of automatic variables Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 07/12] common: memsize: eliminate dead store Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 08/12] USB: musb: remove dead stores Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 09/12] fs: squashfs: remove dead stores for xattr_id Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 10/12] reset: remove dead initialization Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 11/12] sandbox: fix behavior with images >= 4G on 32-bit Ahmad Fatoum
2020-09-30  7:20 ` [PATCH 12/12] blspec: fix dead assignment Ahmad Fatoum
2020-10-02  4:04 ` [PATCH 01/12] hw_random: mxc-rngc: fix read of uninitialized variable Sascha Hauer

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=20201002040401.GM11648@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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