浏览代码

Staging: wilc1000: NULL check before some freeing functions is not needed

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>
Abdul Hussain 10 年之前
父节点
当前提交
0256b5406e
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      drivers/staging/wilc1000/linux_wlan_spi.c

+ 2 - 4
drivers/staging/wilc1000/linux_wlan_spi.c

@@ -214,8 +214,7 @@ int linux_spi_write(uint8_t *b, uint32_t len)
 				PRINT_ER("SPI transaction failed\n");
 				PRINT_ER("SPI transaction failed\n");
 			}
 			}
 		}
 		}
-		if (r_buffer)
-			kfree(r_buffer);
+		kfree(r_buffer);
 	} else {
 	} else {
 		PRINT_ER("can't write data with the following length: %d\n", len);
 		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);
 		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 {
 	} else {
 		PRINT_ER("can't read data with the following length: %ld\n", rlen);
 		PRINT_ER("can't read data with the following length: %ld\n", rlen);
 		ret = -1;
 		ret = -1;