drivers/video/uvesafb.c: 6 * redundant condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there,

I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33-rc8

It said

[./drivers/video/uvesafb.c:238]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[./drivers/video/uvesafb.c:1321]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[./drivers/video/uvesafb.c:1799]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[./drivers/video/uvesafb.c:1822]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[./drivers/video/uvesafb.c:1824]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[./drivers/video/uvesafb.c:1826]: (style) Redundant condition. It is safe to deallocate a NULL pointer


I checked the source code and I agree with cppcheck.
Patch file attached.

Regards

David Binderman

 		 	   		  
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Signed-off-by: David Binderman <dcb314@xxxxxxxxxxx>

--- drivers/video/uvesafb.c.sav	2010-02-21 10:08:27.000000000 +0000
+++ drivers/video/uvesafb.c	2010-02-21 10:09:35.000000000 +0000
@@ -235,8 +235,7 @@ out:
 static void uvesafb_free(struct uvesafb_ktask *task)
 {
 	if (task) {
-		if (task->done)
-			kfree(task->done);
+		kfree(task->done);
 		kfree(task);
 	}
 }
@@ -1318,8 +1317,8 @@ setmode:
 				FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
 	info->fix.line_length = mode->bytes_per_scan_line;
 
-out:	if (crtc != NULL)
-		kfree(crtc);
+out:
+	kfree(crtc);
 	uvesafb_free(task);
 
 	return err;
@@ -1796,8 +1795,7 @@ out_mode:
 	fb_destroy_modedb(info->monspecs.modedb);
 	fb_dealloc_cmap(&info->cmap);
 out:
-	if (par->vbe_modes)
-		kfree(par->vbe_modes);
+	kfree(par->vbe_modes);
 
 	framebuffer_release(info);
 	return err;
@@ -1819,12 +1817,9 @@ static int uvesafb_remove(struct platfor
 		fb_dealloc_cmap(&info->cmap);
 
 		if (par) {
-			if (par->vbe_modes)
-				kfree(par->vbe_modes);
-			if (par->vbe_state_orig)
-				kfree(par->vbe_state_orig);
-			if (par->vbe_state_saved)
-				kfree(par->vbe_state_saved);
+			kfree(par->vbe_modes);
+			kfree(par->vbe_state_orig);
+			kfree(par->vbe_state_saved);
 		}
 
 		framebuffer_release(info);

[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux