From a18dd63047a86e0dc1c927232a526bda6d770bff Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 3 Sep 2015 19:04:19 -0700 Subject: [PATCH] staging: wilc1000: remove pointless kfree wrapper It isn't needed, and we were checking if a buffer was not NULL multiple times, no one had ever looked at the code :( Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 11 +----- drivers/staging/wilc1000/wilc_wlan.c | 45 +++++++++---------------- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 3 files changed, 17 insertions(+), 40 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b576d02242bf..c1289e0ac10d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -549,14 +549,6 @@ static void linux_wlan_dbg(uint8_t *buff) PRINT_D(INIT_DBG, "%d\n", *buff); } -void linux_wlan_free(void *vp) -{ - if (vp != NULL) { - PRINT_D(MEM_DBG, "Freeing %p\n", vp); - kfree(vp); - } -} - static void linux_wlan_init_lock(char *lockName, void *plock, int count) { sema_init((struct semaphore *)plock, count); @@ -1470,7 +1462,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_func.os_sleep = linux_wlan_msleep; nwi->os_func.os_atomic_sleep = linux_wlan_atomic_msleep; nwi->os_func.os_debug = linux_wlan_dbg; - nwi->os_func.os_free = linux_wlan_free; nwi->os_func.os_lock = linux_wlan_lock; nwi->os_func.os_unlock = linux_wlan_unlock; nwi->os_func.os_wait = linux_wlan_lock_timeout; @@ -2112,7 +2103,7 @@ static void linux_wlan_tx_complete(void *priv, int status) PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); /* Free the SK Buffer, its work is done */ dev_kfree_skb(pv_data->skb); - linux_wlan_free(pv_data); + kfree(pv_data); } int mac_xmit(struct sk_buff *skb, struct net_device *ndev) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 970f6a9cc043..95897bf16626 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -459,7 +459,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) tqe->status = 1; /* mark the packet send */ if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); - p->os_func.os_free(tqe); + kfree(tqe); Dropped++; } } @@ -1160,7 +1160,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) Pending_Acks_info[tqe->tcp_PendingAck_index].txqe = NULL; } #endif - p->os_func.os_free(tqe); + kfree(tqe); } else { break; } @@ -1321,11 +1321,9 @@ static void wilc_wlan_handle_rxq(void) #ifndef MEMORY_STATIC - if (buffer != NULL) - p->os_func.os_free((void *)buffer); + kfree(buffer); #endif - if (rqe != NULL) - p->os_func.os_free((void *)rqe); + kfree(rqe); if (has_packet) { if (p->net_func.rx_complete) @@ -1458,8 +1456,7 @@ _end_: } } else { #ifndef MEMORY_STATIC - if (buffer != NULL) - p->os_func.os_free(buffer); + kfree(buffer); #endif } } @@ -1567,8 +1564,7 @@ static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_si _fail_: - if (dma_buffer) - g_wlan.os_func.os_free(dma_buffer); + kfree(dma_buffer); _fail_1: @@ -1800,7 +1796,7 @@ static void wilc_wlan_cleanup(void) break; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, 0); - p->os_func.os_free((void *)tqe); + kfree(tqe); } while (1); do { @@ -1808,9 +1804,9 @@ static void wilc_wlan_cleanup(void) if (rqe == NULL) break; #ifdef MEMORY_DYNAMIC - p->os_func.os_free((void *)tqe->buffer); + kfree(tqe->buffer); #endif - p->os_func.os_free((void *)rqe); + kfree(rqe); } while (1); /** @@ -1818,15 +1814,10 @@ static void wilc_wlan_cleanup(void) **/ #ifdef MEMORY_STATIC - if (p->rx_buffer) { - p->os_func.os_free(p->rx_buffer); - p->rx_buffer = NULL; - } + kfree(p->rx_buffer); + p->rx_buffer = NULL; #endif - if (p->tx_buffer) { - p->os_func.os_free(p->tx_buffer); - p->tx_buffer = NULL; - } + kfree(p->tx_buffer); acquire_bus(ACQUIRE_AND_WAKEUP); @@ -2240,15 +2231,11 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) _fail_: #ifdef MEMORY_STATIC - if (g_wlan.rx_buffer) { - g_wlan.os_func.os_free(g_wlan.rx_buffer); - g_wlan.rx_buffer = NULL; - } + kfree(g_wlan.rx_buffer); + g_wlan.rx_buffer = NULL; #endif - if (g_wlan.tx_buffer) { - g_wlan.os_func.os_free(g_wlan.tx_buffer); - g_wlan.tx_buffer = NULL; - } + kfree(g_wlan.tx_buffer); + g_wlan.tx_buffer = NULL; #if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */ if (!g_wilc_initialized) diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index ed1ed00dd581..5a01d34f6419 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -87,7 +87,6 @@ typedef struct { void (*os_sleep)(uint32_t); void (*os_atomic_sleep)(uint32_t); void (*os_debug)(uint8_t *); - void (*os_free)(void *); void (*os_lock)(void *); void (*os_unlock)(void *); int (*os_wait)(void *, u32); -- 2.30.2