]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: wilc1000: NULL check before some freeing functions is not needed
authorAbdul Hussain <habdul@visteon.com>
Thu, 18 Jun 2015 12:37:00 +0000 (12:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Jun 2015 03:20:57 +0000 (20:20 -0700)
This patch removes check before freeing the memory
since kfree(NULL) is safe

Signed-off-by: Abdul Hussain <habdul@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan_spi.c

index 1eee1d560bc7eac90bf024e1b7480faf0ef836ce..236669cfcd3aed93e1eb190b8f4675979b11d2f8 100644 (file)
@@ -214,8 +214,7 @@ int linux_spi_write(uint8_t *b, uint32_t len)
                                PRINT_ER("SPI transaction failed\n");
                        }
                }
-               if (r_buffer)
-                       kfree(r_buffer);
+               kfree(r_buffer);
        } else {
                PRINT_ER("can't write data with the following length: %d\n", len);
                PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len);
@@ -377,8 +376,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
                        }
                }
 
-               if (t_buffer)
-                       kfree(t_buffer);
+               kfree(t_buffer);
        } else {
                PRINT_ER("can't read data with the following length: %ld\n", rlen);
                ret = -1;