[PATCH] au1100fb: Delete unnecessary checks before two function calls

Subsystems: framebuffer layer, the rest

STALE3411d

5 messages, 2 authors, 2015-02-05 · open the first message on its own page

[PATCH] au1100fb: Delete unnecessary checks before two function calls

From: SF Markus Elfring <hidden>
Date: 2015-02-05 13:15:03

From: Markus Elfring <redacted>
Date: Thu, 5 Feb 2015 14:10:21 +0100

The functions clk_enable() and clk_disable() test whether their argument
is NULL and then return immediately. Thus the test around the calls
is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/fbdev/au1100fb.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 5956018..47ee023 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -605,11 +605,8 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
 	/* Blank the LCD */
 	au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
 
-	if (fbdev->lcdclk)
-		clk_disable(fbdev->lcdclk);
-
+	clk_disable(fbdev->lcdclk);
 	memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
-
 	return 0;
 }
 
@@ -621,13 +618,10 @@ int au1100fb_drv_resume(struct platform_device *dev)
 		return 0;
 
 	memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
-
-	if (fbdev->lcdclk)
-		clk_enable(fbdev->lcdclk);
+	clk_enable(fbdev->lcdclk);
 
 	/* Unblank the LCD */
 	au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
-
 	return 0;
 }
 #else
-- 
2.2.2

Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls

From: Dan Carpenter <hidden>
Date: 2015-02-05 13:41:38

On Thu, Feb 05, 2015 at 02:14:54PM +0100, SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Thu, 5 Feb 2015 14:10:21 +0100

The functions clk_enable() and clk_disable() test whether their argument
is NULL and then return immediately.
This isn't true for clk_enable().

"I find it acceptable that some of my update suggestions do not fit
to your quality expectations at the moment." --
https://lkml.org/lkml/2015/1/22/446

It's frustrating that you make the same mistake over and over and you
are fine with doing that.  If you make a mistake and you are fixing a
bug, then hopefully you fix more bugs than you introduce.  If you make a
mistake and you are doing a cleanup then you are really just introducing
bugs and that's not helpful.  I wish you would find something useful to
do instead of sending these patches.  :(

regards,
dan carpenter

Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls

From: SF Markus Elfring <hidden>
Date: 2015-02-05 14:20:36

quoted
The functions clk_enable() and clk_disable() test whether their argument
is NULL and then return immediately.
This isn't true for clk_enable().
I stumble on an interesting name space issue once more.

It's frustrating that you make the same mistake over and over
and you are fine with doing that.
I admit that there can be also risks with my update suggestions
in similar ways to contributions from other software developers.

A specific function implementation exists which performs also input
parameter validation.
http://lxr.free-electrons.com/source/drivers/sh/clk/core.c#L291

Such variants might not fit to the functions au1100fb_drv_suspend()
and au1100fb_drv_resume().


Do you want that I send a reduced patch?

Regards,
Markus

Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls

From: Dan Carpenter <hidden>
Date: 2015-02-05 17:21:50

On Thu, Feb 05, 2015 at 03:20:27PM +0100, SF Markus Elfring wrote:
quoted
quoted
The functions clk_enable() and clk_disable() test whether their argument
is NULL and then return immediately.
This isn't true for clk_enable().
I stumble on an interesting name space issue once more.
The "once more" is the problem in this statement.  Other people would
have stopped making the mistake by now.  I am able to see your bugs so
you should be able to see your bugs as well.
quoted
It's frustrating that you make the same mistake over and over
and you are fine with doing that.
I admit that there can be also risks with my update suggestions
in similar ways to contributions from other software developers.
At times, I have told other people to stop sending cleanups until they
can at least fix a bugs to balance out the bugs they have introduced.
It's unacceptable to only introduce bugs and never fix any.

regards,
dan carpenter

Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls

From: SF Markus Elfring <hidden>
Date: 2015-02-05 20:15:54

It's unacceptable to only introduce bugs
Such a view is generally fine.

Would you like to point any more update candidates out from my
suggestion collection?

and never fix any.
Would you like to clarify any statistics around my update suggestions?

Regards,
Markus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help