hw_random : platform_get_irq() already prints an error
PATCH 1/1 hw_random : platform_get_irq() already prints an error
coccicheck
drivers/char//hw_random/imx-rngc.c:256:2-9: line 256 is redundant because platform_get_irq() already prints an error
--- drivers/char/hw_random/imx-rngc.c | 1 - 1 file changed, 1 deletion(-)
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; }
Signature · 1 line
2.28.0
This should also go to the maintainers of the file, which you can find using the script scripts/get_maintainer.pl.
hw_random is not the right way to start the subject line for this file. Use git log --oneline to see what others have done.
Quoted 2 lines · Nigel Christian
coccicheck
drivers/char//hw_random/imx-rngc.c:256:2-9: line 256 is redundant becauseplatform_get_irq()already prints an error
The log message should be limited to at most 75 columns, because when it ends up in git it will be slightly indented.
The log message should explain what you are doing and why, not just repeat the output of a tool. In particular, the file and line number should not be included in the log message, because that information is already available in the changes below.
julia
Quoted 21 lines
Signed-off-by Nigel Christian <[email protected]>--- drivers/char/hw_random/imx-rngc.c | 1 - 1 file changed, 1 deletion(-)drivers/char/hw_random/imx-rngc.c +0
-2@@ -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
Quoted 13 lines · Nigel Christian
coccicheck
drivers/char//hw_random/imx-rngc.c:256:2-9: line 256 is redundant becauseplatform_get_irq()already prints an errorSigned-off-by Nigel Christian <[email protected]>--- drivers/char/hw_random/imx-rngc.c | 1 - 1 file changed, 1 deletion(-)drivers/char/hw_random/imx-rngc.c +0
-0
drivers/char/hw_random/imx-rngc.c static int imx_rngc_probe(struct platform_device *pdev) · line 255
Quoted 3 lines
drivers/char/hw_random/imx-rngc.c +0
-0@@ -253,7 +253,6 @@ static int imx_rngc_probe(struct platform_device *pdev) irq =platform_get_irq (pdev,0 );if (irq <=0 ) {
^^^^^^^^
This check is wrong. It should be:
if (irq < 0) {The platform_get_irq() function will never return zero. But say it did return a zero then that means that "return irq;" is returning success which would be a bug.
drivers/char/hw_random/imx-rngc.c static int imx_rngc_probe(struct platform_device *pdev) · line 257
Quoted 3 lines
drivers/char/hw_random/imx-rngc.c +0
-1-dev_err (&pdev->dev,"Couldn't get irq %d\n" , irq);return irq; }
The patch introduces a new checkpatch warning because now there is only one statement in the if statment block. (Patches shouldn't introduce checkpatch warnings). It should be:
irq = platform_get_irq(pdev, 0); if (irq < 0) return irq;
regards,
dan carpenter