[PATCH]: pohmelfs/config.c: 2 * redundant code

[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.34-rc1

It said

[staging/pohmelfs/config.c:610]: (style) Redundant condition. It is safe to deallocate a NULL pointer
[staging/pohmelfs/config.c:613]: (style) Redundant condition. It is safe to deallocate a NULL pointer

The source code is

                if (g->hash_string)
                        kfree(g->hash_string);

                if (g->cipher_string)
                        kfree(g->cipher_string);


Proposed patch file attached.


Regards

David Binderman

 		 	   		  
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Signed-off-by: David Binderman <dcb314@xxxxxxxxxxx>

--- staging/pohmelfs/config.c.sav	2010-03-19 09:39:24.000000000 +0000
+++ staging/pohmelfs/config.c	2010-03-19 09:39:37.000000000 +0000
@@ -607,11 +607,9 @@ void pohmelfs_config_exit(void)
 
 		list_del(&g->group_entry);
 
-		if (g->hash_string)
-			kfree(g->hash_string);
+		kfree(g->hash_string);
 
-		if (g->cipher_string)
-			kfree(g->cipher_string);
+		kfree(g->cipher_string);
 
 		kfree(g);
 	}
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux