public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq()
@ 2024-10-23  8:35 Dan Carpenter
  2024-10-23 14:38 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-10-23  8:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	kernel-janitors

The platform_get_irq() function never returns zero so delete this check.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
I have written more about the history of platform_get_irq() on my blog:
https://staticthinking.wordpress.com/2023/08/07/writing-a-check-for-zero-irq-error-codes/

 drivers/gpio/gpio-mb86s7x.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c
index 7efc9fc6f4cd..7ee891ef6905 100644
--- a/drivers/gpio/gpio-mb86s7x.c
+++ b/drivers/gpio/gpio-mb86s7x.c
@@ -145,8 +145,6 @@ static int mb86s70_gpio_to_irq(struct gpio_chip *gc, unsigned int offset)
 		irq = platform_get_irq(to_platform_device(gc->parent), index);
 		if (irq < 0)
 			return irq;
-		if (irq == 0)
-			break;
 		if (irq_get_irq_data(irq)->hwirq == offset)
 			return irq;
 	}
-- 
2.45.2


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

* Re: [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq()
  2024-10-23  8:35 [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq() Dan Carpenter
@ 2024-10-23 14:38 ` Andy Shevchenko
  2024-10-23 14:46 ` Andy Shevchenko
  2024-10-24  8:38 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-10-23 14:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	kernel-janitors

On Wed, Oct 23, 2024 at 11:35:53AM +0300, Dan Carpenter wrote:
> The platform_get_irq() function never returns zero so delete this check.

Yes, effectively a dead code.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq()
  2024-10-23  8:35 [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq() Dan Carpenter
  2024-10-23 14:38 ` Andy Shevchenko
@ 2024-10-23 14:46 ` Andy Shevchenko
  2024-10-24  8:38 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-10-23 14:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	kernel-janitors

On Wed, Oct 23, 2024 at 11:35:53AM +0300, Dan Carpenter wrote:

...

> I have written more about the history of platform_get_irq() on my blog:
> https://staticthinking.wordpress.com/2023/08/07/writing-a-check-for-zero-irq-error-codes/

FWIW, this patch (see https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git)

commit e13724956849975ef40cbc9898643f3074a1ed8a
Author: Russell King <rmk@arm.linux.org.uk>
Date:   Tue Jun 8 02:28:02 2004 -0700

    [PATCH] Add platform_get_resource()
    
    This patch adds management of platform device resources to the
    device model, allowing drivers to lookup resources, IRQs and DMA
    numbers in the platform device resource array.  We also add a
    couple of functions which allow platform devices and their resources
    to be registered.

added it.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq()
  2024-10-23  8:35 [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq() Dan Carpenter
  2024-10-23 14:38 ` Andy Shevchenko
  2024-10-23 14:46 ` Andy Shevchenko
@ 2024-10-24  8:38 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-10-24  8:38 UTC (permalink / raw)
  To: Andy Shevchenko, Dan Carpenter
  Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski,
	linux-gpio, linux-kernel, kernel-janitors

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Wed, 23 Oct 2024 11:35:53 +0300, Dan Carpenter wrote:
> The platform_get_irq() function never returns zero so delete this check.
> 
> 

Applied, thanks!

[1/1] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq()
      commit: 4295f4ccfe8c6e6ac5b631919ba7a4fe89d22acf

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

end of thread, other threads:[~2024-10-24  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23  8:35 [PATCH] gpio: mb86s7x: remove some dead code in mb86s70_gpio_to_irq() Dan Carpenter
2024-10-23 14:38 ` Andy Shevchenko
2024-10-23 14:46 ` Andy Shevchenko
2024-10-24  8:38 ` Bartosz Golaszewski

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