All of lore.kernel.org
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>, <davem@davemloft.net>,
	<f.fainelli@gmail.com>, <hkallweit1@gmail.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] mdio_bus: Fix PTR_ERR() usage after initialization to constant
Date: Sat, 16 Feb 2019 10:40:57 +0800	[thread overview]
Message-ID: <b70da77c-37d4-1e52-20e6-5cf038e34bcf@huawei.com> (raw)
In-Reply-To: <20190201042411.GM2217@ZenIV.linux.org.uk>


On 2019/2/1 12:24, Al Viro wrote:
> On Tue, Jan 29, 2019 at 11:30:27AM +0800, YueHaibing wrote:
>>>>  		gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
>>>>  					       "reset-gpios", 0, GPIOD_OUT_LOW,
>>>>  					       "PHY reset");
>>>> -	if (PTR_ERR(gpiod) == -ENOENT ||
>>>> -	    PTR_ERR(gpiod) == -ENOSYS)
>>>> -		gpiod = NULL;
>>>> -	else if (IS_ERR(gpiod))
>>>> -		return PTR_ERR(gpiod);
>>>> +	if (IS_ERR(gpiod)) {
>>>> +		ret = PTR_ERR(gpiod);
>>>> +		if (ret == -ENOENT || ret == -ENOSYS)
>>>> +			gpiod = NULL;
>>>> +		else
>>>> +			return ret;
>>>> +	}
> 
> Rule of the thumb: PTR_ERR(p) == -E... is almost always better off
> as p == ERR_PTR(-E...)

Ok, will fix it.

> 
> .
> 


      reply	other threads:[~2019-02-16  2:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 13:24 [PATCH net-next] mdio_bus: Fix PTR_ERR() usage after initialization to constant YueHaibing
2019-01-28 14:36 ` Andrew Lunn
2019-01-29  3:30   ` YueHaibing
2019-02-01  4:24     ` Al Viro
2019-02-16  2:40       ` YueHaibing [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=b70da77c-37d4-1e52-20e6-5cf038e34bcf@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.