From: Kishon Vijay Abraham I <kishon@ti.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] phy: core: Fix error checking in (devm_)phy_optional_get
Date: Tue, 7 Apr 2015 19:51:29 +0530 [thread overview]
Message-ID: <5523E7E9.7010805@ti.com> (raw)
In-Reply-To: <1428406995.5137.1.camel@phoenix>
Hi,
On Tuesday 07 April 2015 05:13 PM, Axel Lin wrote:
> Don't pass valid pointer to PTR_ERR, use PTR_ERR(phy) only when
> IS_ERR(phy) is true.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/phy/phy-core.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 3791838f..f112fff 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -530,8 +530,10 @@ struct phy *phy_optional_get(struct device *dev, const char *string)
> {
> struct phy *phy = phy_get(dev, string);
>
> - if (PTR_ERR(phy) == -ENODEV)
> - phy = NULL;
> + if (IS_ERR(phy)) {
> + if (PTR_ERR(phy) == -ENODEV)
This can simply be (IS_ERR(phy) && (PTR_ERR(phy) == -ENODEV)).
But I don't see a problem passing a valid pointer to PTR_ERR here.
Thanks
Kishon
next prev parent reply other threads:[~2015-04-07 14:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 11:43 [PATCH] phy: core: Fix error checking in (devm_)phy_optional_get Axel Lin
2015-04-07 14:21 ` Kishon Vijay Abraham I [this message]
2015-04-07 23:32 ` Axel Lin
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=5523E7E9.7010805@ti.com \
--to=kishon@ti.com \
--cc=axel.lin@ingics.com \
--cc=linux-kernel@vger.kernel.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 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.