Skip to contentSkip to conversation

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

PATCH New Abdul, Hussain (H.) 1 participant 1 message Jun 18, 2015 Staging

lore
Share & tools
lore
#0 lore raw

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

From: Abdul Hussain <[email protected]>

This patch removes check before freeing the memory since kfree(NULL) is safe

---
 drivers/staging/wilc1000/linux_wlan_spi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/linux_wlan_spi.c +2 -4
index 1eee1d5..236669c 100644
@@ -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;
Signature · 1 line
1.9.1