diff mbox series

[-next,v2] gpio: omap: Remove redundant dev_err_probe()

Message ID 20230727115704.2663211-1-ruanjinjie@huawei.com
State New
Headers show
Series [-next,v2] gpio: omap: Remove redundant dev_err_probe() | expand

Commit Message

Jinjie Ruan July 27, 2023, 11:57 a.m. UTC
There is no need to call the dev_err_probe() function directly to print
a custom message when handling an error from platform_get_irq() function as
it is going to display an appropriate error message in case of a failure.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
---
v2:
- split into 2 patches on per-driver basis
---
 drivers/gpio/gpio-omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jinjie Ruan July 27, 2023, 12:22 p.m. UTC | #1
On 2023/7/27 20:02, Andy Shevchenko wrote:
> On Thu, Jul 27, 2023 at 07:57:04PM +0800, Ruan Jinjie wrote:
>> There is no need to call the dev_err_probe() function directly to print
>> a custom message when handling an error from platform_get_irq() function as
>> it is going to display an appropriate error message in case of a failure.
> 
> ...
> 
>> @@ -1415,7 +1415,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
>>  	if (bank->irq <= 0) {
>>  		if (!bank->irq)
>>  			bank->irq = -ENXIO;
>> -		return dev_err_probe(dev, bank->irq, "can't get irq resource\n");
>> +		return bank->irq;
>>  	}
> 
> Actually you may go further here and drop a dead code:
> 
> 	if (bank->irq < 0)
> 		return bank->irq;
> 
> will suffice.

You are right! platform_get_irq() do not return 0, I'll fix the issue in v3.

>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 2b78fde74e30..21c8cfedfd64 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1415,7 +1415,7 @@  static int omap_gpio_probe(struct platform_device *pdev)
 	if (bank->irq <= 0) {
 		if (!bank->irq)
 			bank->irq = -ENXIO;
-		return dev_err_probe(dev, bank->irq, "can't get irq resource\n");
+		return bank->irq;
 	}
 
 	bank->chip.parent = dev;