[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOMZO5Ce3yAEghVRFW7v0PaCA4Mz6xbGaAuyCTEDhEk=W726LA@mail.gmail.com>
Date: Tue, 18 Jul 2017 10:09:21 -0300
From: Fabio Estevam <festevam@...il.com>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Fabio Estevam <fabio.estevam@....com>
Subject: Re: [PATCH net-next] mdio_bus: Remove unneeded gpiod NULL check
On Tue, Jul 18, 2017 at 10:02 AM, Sergei Shtylyov
<sergei.shtylyov@...entembedded.com> wrote:
> No, it does -- devm_gpiod_get_optinal() will return NULL in that case,
> bus->reset_gpio will remanin NULL, and you're removing the NULL checks
> around the gpiod_set_value_cansleep() calls. Perhaps it's the problem in the
> GPIO support though...
It is perfectly fine to call gpiod_set_value_cansleep() with a NULL
gpio descriptor.
Please take a look at drivers/gpio/gpiolib.c:
gpiod_set_value_cansleep() calls VALIDATE_DESC_VOID
Then if you look at the definition of VALIDATE_DESC_VOID you will see
that it does a NULL check on desc and returns immediately if it is
NULL.
This means we are safe here :-)
Powered by blists - more mailing lists