2020-10-19 09:49:01

by Nigel Christian

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Nigel Christian <[email protected]>
---
drivers/char/hw_random/imx-rngc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 61c844baf26e..69f13ff1bbec 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -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;
}

--
2.28.0


2020-10-23 05:35:24

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH] hwrng: imx-rngc - platform_get_irq() already prints an error

Thus wrote Nigel Christian ([email protected]):

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

> Signed-off-by: Nigel Christian <[email protected]>
> ---
> drivers/char/hw_random/imx-rngc.c | 1 -
> 1 file changed, 1 deletion(-)

> diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
> index 61c844baf26e..69f13ff1bbec 100644
> --- a/drivers/char/hw_random/imx-rngc.c
> +++ b/drivers/char/hw_random/imx-rngc.c
> @@ -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.

Reviewed-by: Martin Kaiser <[email protected]>