Skip to contentSkip to conversation

au1100fb: Remove NULL pointer check before clk_enable/disable

PATCH In review Xu Wang 2 participants 3 messages Oct 14, 2020 – Oct 19, 2020 Framebuffer layer

lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 au1100fb: Remove NULL pointer check before clk_enable/disable

Because clk_enable, clk_disable, clk_prepare, and clk_unprepare already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

---
 drivers/video/fbdev/au1100fb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/video/fbdev/au1100fb.c +2 -4
index 37a6512feda0..3659dfbb81c1 100644
@@ -560,8 +560,7 @@ 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));
 
@@ -577,8 +576,7 @@ int au1100fb_drv_resume(struct platform_device *dev)
 
 	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);
Signature · 1 line
2.17.1
#1 lore raw

Hi

Quoted 3 lines · On Wed, 14 Oct 2020 08:21:37 +0000 Xu Wang <[email protected]> wrote:

Because clk_enable, clk_disable, clk_prepare, and clk_unprepare already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

All clk_*() functions seem to handle NULL pointers gracefully, so you can also remove these checks from the driver's _probe and _remove functions.

Best regards
Thomas

Quoted 30 lines
---
 drivers/video/fbdev/au1100fb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/video/fbdev/au1100fb.c +0 -0
index 37a6512feda0..3659dfbb81c1 100644
@@ -560,8 +560,7 @@ int au1100fb_drv_suspend(struct platform_device *dev,

pm_message_t state) /* Blank the LCD */

drivers/video/fbdev/au1100fb.c +2 -4
 	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));
@@ -577,8 +576,7 @@ int au1100fb_drv_resume(struct platform_device *dev)
 
 	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);
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Reviewed-by on v1 1/1
#2 lore raw
In reply to Xu Wang

Hi

Quoted 5 lines · Xu Wang

Because clk_enable, clk_disable, clk_prepare, and clk_unprepare already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

Sam convinced me to merge this patch as-is with out the additional cleanup of the driver. So

I'll merge it into drm-misc-next.

I'd still like to encourage you to send a patch for the other clk_* calls in au1100fb.

Best regard
Thomas

Quoted 29 lines
---
 drivers/video/fbdev/au1100fb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/video/fbdev/au1100fb.c +2 -4
index 37a6512feda0..3659dfbb81c1 100644
@@ -560,8 +560,7 @@ 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));
 
@@ -577,8 +576,7 @@ int au1100fb_drv_resume(struct platform_device *dev)
 
 	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);
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer