mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpio: mockup: Drop duplicate NULL check in gpio_mockup_unregister_pdevs()
@ 2021-03-15 18:51 Andy Shevchenko
  2021-03-16  9:22 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-03-15 18:51 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Bamvor Jian Zhang, Linus Walleij

Since platform_device_unregister() is NULL-aware, we don't need to duplicate
this check. Remove it and fold the rest of the code.

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

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 28b757d34046..d7e73876a3b9 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -479,15 +479,10 @@ static struct platform_device *gpio_mockup_pdevs[GPIO_MOCKUP_MAX_GC];
 
 static void gpio_mockup_unregister_pdevs(void)
 {
-	struct platform_device *pdev;
 	int i;
 
-	for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++) {
-		pdev = gpio_mockup_pdevs[i];
-
-		if (pdev)
-			platform_device_unregister(pdev);
-	}
+	for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++)
+		platform_device_unregister(gpio_mockup_pdevs[i]);
 }
 
 static __init char **gpio_mockup_make_line_names(const char *label,
-- 
2.30.2


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

* Re: [PATCH v1 1/1] gpio: mockup: Drop duplicate NULL check in gpio_mockup_unregister_pdevs()
  2021-03-15 18:51 [PATCH v1 1/1] gpio: mockup: Drop duplicate NULL check in gpio_mockup_unregister_pdevs() Andy Shevchenko
@ 2021-03-16  9:22 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2021-03-16  9:22 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, LKML, Bamvor Jian Zhang, Linus Walleij

On Mon, Mar 15, 2021 at 7:51 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since platform_device_unregister() is NULL-aware, we don't need to duplicate
> this check. Remove it and fold the rest of the code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-mockup.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 28b757d34046..d7e73876a3b9 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -479,15 +479,10 @@ static struct platform_device *gpio_mockup_pdevs[GPIO_MOCKUP_MAX_GC];
>
>  static void gpio_mockup_unregister_pdevs(void)
>  {
> -       struct platform_device *pdev;
>         int i;
>
> -       for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++) {
> -               pdev = gpio_mockup_pdevs[i];
> -
> -               if (pdev)
> -                       platform_device_unregister(pdev);
> -       }
> +       for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++)
> +               platform_device_unregister(gpio_mockup_pdevs[i]);
>  }
>
>  static __init char **gpio_mockup_make_line_names(const char *label,
> --
> 2.30.2
>

Applied, thanks!

Bartosz

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

end of thread, other threads:[~2021-03-16  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 18:51 [PATCH v1 1/1] gpio: mockup: Drop duplicate NULL check in gpio_mockup_unregister_pdevs() Andy Shevchenko
2021-03-16  9:22 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome