linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request()
@ 2023-03-09 18:56 Andy Shevchenko
  2023-03-10  9:42 ` Linus Walleij
  2023-03-15  9:48 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-03-09 18:56 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

The gpiod_find_by_fwnode() already checks for NULL and returns
correct error code in case fwnode is invalid. Drop the respective
check and assignment in the gpiod_find_and_request().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8ecfe3afde1e..333ccd44e2b2 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3927,13 +3927,10 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
 						bool platform_lookup_allowed)
 {
 	unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
-	struct gpio_desc *desc = ERR_PTR(-ENOENT);
+	struct gpio_desc *desc;
 	int ret;
 
-	if (!IS_ERR_OR_NULL(fwnode))
-		desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx,
-					    &flags, &lookupflags);
-
+	desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, &flags, &lookupflags);
 	if (gpiod_not_found(desc) && platform_lookup_allowed) {
 		/*
 		 * Either we are not using DT or ACPI, or their lookup did not
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request()
  2023-03-09 18:56 [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request() Andy Shevchenko
@ 2023-03-10  9:42 ` Linus Walleij
  2023-03-15  9:48 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2023-03-10  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Bartosz Golaszewski

On Thu, Mar 9, 2023 at 7:56 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> The gpiod_find_by_fwnode() already checks for NULL and returns
> correct error code in case fwnode is invalid. Drop the respective
> check and assignment in the gpiod_find_and_request().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request()
  2023-03-09 18:56 [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request() Andy Shevchenko
  2023-03-10  9:42 ` Linus Walleij
@ 2023-03-15  9:48 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2023-03-15  9:48 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Thu, Mar 9, 2023 at 7:56 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The gpiod_find_by_fwnode() already checks for NULL and returns
> correct error code in case fwnode is invalid. Drop the respective
> check and assignment in the gpiod_find_and_request().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 8ecfe3afde1e..333ccd44e2b2 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -3927,13 +3927,10 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
>                                                 bool platform_lookup_allowed)
>  {
>         unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
> -       struct gpio_desc *desc = ERR_PTR(-ENOENT);
> +       struct gpio_desc *desc;
>         int ret;
>
> -       if (!IS_ERR_OR_NULL(fwnode))
> -               desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx,
> -                                           &flags, &lookupflags);
> -
> +       desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, &flags, &lookupflags);
>         if (gpiod_not_found(desc) && platform_lookup_allowed) {
>                 /*
>                  * Either we are not using DT or ACPI, or their lookup did not
> --
> 2.39.1
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-15  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 18:56 [PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request() Andy Shevchenko
2023-03-10  9:42 ` Linus Walleij
2023-03-15  9:48 ` Bartosz Golaszewski

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).