]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: wilc1000: remove pointless kfree wrapper
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Sep 2015 02:04:19 +0000 (19:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:40 +0000 (18:24 -0700)
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 <johnny.kim@atmel.com>
Cc: Rachel Kim <rachel.kim@atmel.com>
Cc: Dean Lee <dean.lee@atmel.com>
Cc: Chris Park <chris.park@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wlan.c
drivers/staging/wilc1000/wilc_wlan_if.h

index b576d02242bf588aaa4104c5f46e4efa458e8ecf..c1289e0ac10df3c7ac9adf449915ee89bb923035 100644 (file)
@@ -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)
index 970f6a9cc0434dea785905baf6ba13a93b7f0e57..95897bf1662602888c4e43aa699387ccf8a0d891 100644 (file)
@@ -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)
index ed1ed00dd5811b349316cc951b286077c2b132e1..5a01d34f6419081b8f70609b945a1022add84d72 100644 (file)
@@ -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);