Skip to contentSkip to conversation

hwrng: imx-rngc - platform_get_irq() already prints an error

PATCH Superseded Nigel Christian 2 participants 2 messages Oct 18, 2020 – Oct 22, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwrng: imx-rngc - platform_get_irq() already prints an error

There is no need to call the dev_err() function directly to print a custom message when handling an error from platform_get_irq() as it prints the appropriate message in the event of a failure. Change suggested via coccicheck report.

---
 drivers/char/hw_random/imx-rngc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +0 -1
index 61c844baf26e..69f13ff1bbec 100644
@@ -253,7 +253,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
-		dev_err(&pdev->dev, "Couldn't get irq %d\n", irq);
 		return irq;
 	}
 
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw

Thus wrote Nigel Christian ([email protected]):

Quoted 15 lines

There is no need to call the dev_err() function directly to print a custom message when handling an error from platform_get_irq() as it prints the appropriate message in the event of a failure. Change suggested via coccicheck report.

---
 drivers/char/hw_random/imx-rngc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +0 -0
index 61c844baf26e..69f13ff1bbec 100644

drivers/char/hw_random/imx-rngc.c static int imx_rngc_probe(struct platform_device *pdev) · line 257

Quoted 6 lines
drivers/char/hw_random/imx-rngc.c +0 -1
@@ -253,7 +253,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
-		dev_err(&pdev->dev, "Couldn't get irq %d\n", irq);
 		return irq;
 	}

Looks good to me. This suppresses the error message if platform_get_irq returns -EPROBE_DEFER, which makes more sense than the current code.