[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdbPxHgyTAnE12PrMRu9XQqdoXmS+SWXYrSKXgL_SWOzcw@mail.gmail.com>
Date: Tue, 25 Jun 2019 15:47:44 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Waibel Georg <Georg.Waibel@...sor-technik.de>
Cc: Krzysztof Kozlowski <krzk@...nel.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Support Opensource <support.opensource@...semi.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Sangbeom Kim <sbkim73@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-samsung-soc@...r.kernel.org"
<linux-samsung-soc@...r.kernel.org>
Subject: Re: [PATCH V2] gpio: Fix return value mismatch of function gpiod_get_from_of_node()
Hi Georg,
first: good catch! Sorry for breaking this, and kudos for fixing it!
On Thu, Jun 20, 2019 at 11:37 PM Waibel Georg
<Georg.Waibel@...sor-technik.de> wrote:
> In case the requested gpio property is not found in the device tree, some
> callers of gpiod_get_from_of_node() expect a return value of NULL, others
> expect -ENOENT.
> In particular devm_fwnode_get_index_gpiod_from_child() expects -ENOENT.
> Currently it gets a NULL, which breaks the loop that tries all
> gpio_suffixes. The result is that a gpio property is not found, even
> though it is there.
>
> This patch changes gpiod_get_from_of_node() to return -ENOENT instead
> of NULL when the requested gpio property is not found in the device
> tree. Additionally it modifies all calling functions to properly
> evaluate the return value.
>
> Another approach would be to leave the return value of
> gpiod_get_from_of_node() as is and fix the bug in
> devm_fwnode_get_index_gpiod_from_child(). Other callers would still need
> to be reworked. The effort would be the same as with the chosen solution.
>
> Signed-off-by: Georg Waibel <georg.waibel@...sor-technik.de>
> ---
>
> V2: Rebased on top of [PATCH] regulator: s2mps11: Fix ERR_PTR dereference on GPIO lookup failure
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Mark: as most of the changed lines are in the regulator tree,
would you please pick this patch up?
(Else tell me and I will take care of it.)
Yours,
Linus Walleij
Powered by blists - more mailing lists