public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: dingsenjie@163.com, richardcochran@gmail.com,
	davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, dingsenjie <dingsenjie@yulong.com>
Subject: Re: [PATCH] net: phy: Simplify the return expression of dp83640_ack_interrupt
Date: Sat, 5 Jun 2021 01:02:21 +0200	[thread overview]
Message-ID: <YLqw/Z22iMATS1IF@lunn.ch> (raw)
In-Reply-To: <91609670-c3a2-2281-514e-01dfe7907f11@gmail.com>

On Fri, Jun 04, 2021 at 09:49:17AM +0200, Heiner Kallweit wrote:
> On 04.06.2021 05:22, dingsenjie@163.com wrote:
> > From: dingsenjie <dingsenjie@yulong.com>
> > 
> > Simplify the return expression.
> > 
> > Signed-off-by: dingsenjie <dingsenjie@yulong.com>
> > ---
> >  drivers/net/phy/dp83640.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
> > index 0d79f68..bcd14ec 100644
> > --- a/drivers/net/phy/dp83640.c
> > +++ b/drivers/net/phy/dp83640.c
> > @@ -1141,12 +1141,7 @@ static int dp83640_config_init(struct phy_device *phydev)
> >  
> >  static int dp83640_ack_interrupt(struct phy_device *phydev)
> >  {
> > -	int err = phy_read(phydev, MII_DP83640_MISR);
> > -
> > -	if (err < 0)
> > -		return err;
> > -
> > -	return 0;
> > +	return phy_read(phydev, MII_DP83640_MISR);
> >  }
> >  
> >  static int dp83640_config_intr(struct phy_device *phydev)
> > 
> This would be a functional change. You'd return a positive value
> instead of 0.

And looking a bit further down in the code:

static int dp83640_ack_interrupt(struct phy_device *phydev)
{
        int err = phy_read(phydev, MII_DP83640_MISR);

        if (err < 0)
                return err;

        return 0;
}

static int dp83640_config_intr(struct phy_device *phydev)
{
        int micr;
        int misr;
        int err;

        if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
                err = dp83640_ack_interrupt(phydev);
                if (err)
                        return err;

So a positive value is going to break the driver.

NACK

	Andrew

      reply	other threads:[~2021-06-04 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04  3:22 [PATCH] net: phy: Simplify the return expression of dp83640_ack_interrupt dingsenjie
2021-06-04  7:49 ` Heiner Kallweit
2021-06-04 23:02   ` Andrew Lunn [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=YLqw/Z22iMATS1IF@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dingsenjie@163.com \
    --cc=dingsenjie@yulong.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@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