Netdev List
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: Aditya Pakki <pakki001@umn.edu>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: dsa: bcm_sf2: Propagate error value from mdio_write
Date: Wed, 26 Dec 2018 20:41:50 +0100	[thread overview]
Message-ID: <9d5f9506-fc2f-cf17-1fe5-3b1977e2fdf9@gmail.com> (raw)
In-Reply-To: <CAK8KejrSvuFF546cSTwN_XWD6N8FxbSCjxCUsqaQ_N6S8nTA5A@mail.gmail.com>

On 26.12.2018 20:32, Kangjie Lu wrote:
> 
> 
> On Wed, Dec 26, 2018 at 1:13 PM Heiner Kallweit <hkallweit1@gmail.com <mailto:hkallweit1@gmail.com>> wrote:
> 
>     On 26.12.2018 19:21, Kangjie Lu wrote:
>     > Both bcm_sf2_sw_indir_rw and mdiobus_write_nested could fail, so let's
>     > return their error codes upstream.
>     >
>     > Signed-off-by: Kangjie Lu <kjlu@umn.edu <mailto:kjlu@umn.edu>>
>     > ---
>     >  drivers/net/dsa/bcm_sf2.c | 7 +++----
>     >  1 file changed, 3 insertions(+), 4 deletions(-)
>     >
>     > diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
>     > index 2eb68769562c..236815700fba 100644
>     > --- a/drivers/net/dsa/bcm_sf2.c
>     > +++ b/drivers/net/dsa/bcm_sf2.c
>     > @@ -303,11 +303,10 @@ static int bcm_sf2_sw_mdio_write(struct mii_bus *bus, int addr, int regnum,
>     >        * send them to our master MDIO bus controller
>     >        */
>     >       if (addr == BRCM_PSEUDO_PHY_ADDR && priv->indir_phy_mask & BIT(addr))
>     > -             bcm_sf2_sw_indir_rw(priv, 0, addr, regnum, val);
>     > +             return bcm_sf2_sw_indir_rw(priv, 0, addr, regnum, val);
>     This is wrong. Please get familiar with what the function does.
>     And test changes before submitting them!
> 
>  
> bcm_sf2_sw_indir_rw() doesn't return an error code, so we don't propagate its return value but return 0 after it.
> 
> For mdiobus_write_nested(), since it does return an error code, we propagate its error code upstream. 
> 
> Does this sound right to you?
>  
Better. You should test a change before submitting (and better not only compile-test).
And please no HTML mails. Get familiar with the basics of kernel development
before submitting. Read document "SubmittingPatches" and the following for netdev:
https://www.kernel.org/doc/Documentation/networking/netdev-FAQ.txt
By the way: net-next is closed currently.

> 
> 
>     >       else
>     > -             mdiobus_write_nested(priv->master_mii_bus, addr, regnum, val);
>     > -
>     > -     return 0;
>     > +             return mdiobus_write_nested(priv->master_mii_bus,
>     > +                             addr, regnum, val);
>     >  }
>     > 
>     >  static irqreturn_t bcm_sf2_switch_0_isr(int irq, void *dev_id)
>     >
> 
> 
> 
> -- 
> Kangjie Lu
> Assistant Professor
> Department of Computer Science and Engineering
> University of Minnesota
> Personal homepage <https://www-users.cs.umn.edu/~kjlu>

  parent reply	other threads:[~2018-12-26 19:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 18:21 [PATCH] net: dsa: bcm_sf2: Propagate error value from mdio_write Kangjie Lu
2018-12-26 19:13 ` Heiner Kallweit
     [not found]   ` <CAK8KejrSvuFF546cSTwN_XWD6N8FxbSCjxCUsqaQ_N6S8nTA5A@mail.gmail.com>
2018-12-26 19:41     ` Heiner Kallweit [this message]
2018-12-26 20:34   ` David Miller

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=9d5f9506-fc2f-cf17-1fe5-3b1977e2fdf9@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=vivien.didelot@gmail.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