From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Linus Walleij <linus.walleij@linaro.org>,
netdev <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: mdio: switch to using gpiod_get_optional()
Date: Sun, 15 Sep 2019 14:13:46 +0300 [thread overview]
Message-ID: <CAHp75VdtnpO6GU8w_cTdc9dM4ob_hDt56aPU9a8iOgVw06uKQg@mail.gmail.com> (raw)
In-Reply-To: <20190915060524.GC237523@dtor-ws>
On Sun, Sep 15, 2019 at 9:26 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Sat, Sep 14, 2019 at 08:09:33PM +0300, Andy Shevchenko wrote:
> > On Fri, Sep 13, 2019 at 03:55:47PM -0700, Dmitry Torokhov wrote:
> > > + mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev,
> > > + "reset", GPIOD_OUT_LOW);
> > > + error = PTR_ERR_OR_ZERO(mdiodev->reset_gpio);
> > > + if (error)
> > > + return error;
> > > + if (mdiodev->reset_gpio)
> >
> > This is redundant check.
>
> I see that gpiod_* API handle NULL desc and usually return immediately,
> but frankly I am not that comfortable with it. I'm OK with functions
> that free/destroy objects that recognize NULL resources,
> but it is
> unusual for other types of APIs.
CLK, reset, ... frameworks do check for NULL pointer since they
provide an *_optional() getters. So, it's not unusual.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2019-09-15 11:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 22:55 [PATCH v2] net: mdio: switch to using gpiod_get_optional() Dmitry Torokhov
2019-09-14 15:21 ` Andrew Lunn
2019-09-14 17:09 ` Andy Shevchenko
2019-09-15 6:05 ` Dmitry Torokhov
2019-09-15 11:13 ` Andy Shevchenko [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=CAHp75VdtnpO6GU8w_cTdc9dM4ob_hDt56aPU9a8iOgVw06uKQg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dmitry.torokhov@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).