enic: Check if rq/wq buf not NULL before freeing them
authorRoopa Prabhu <roprabhu@cisco.com>
Tue, 10 Aug 2010 18:55:20 +0000 (18:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Aug 2010 09:32:58 +0000 (02:32 -0700)
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enic/vnic_rq.c
drivers/net/enic/vnic_wq.c

index dbb2aca258b9087ed1734dd2b7da61e478702303..b236d7cbc137ba0831c8bb6aa5e046038a236d76 100644 (file)
@@ -77,8 +77,10 @@ void vnic_rq_free(struct vnic_rq *rq)
        vnic_dev_free_desc_ring(vdev, &rq->ring);
 
        for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) {
-               kfree(rq->bufs[i]);
-               rq->bufs[i] = NULL;
+               if (rq->bufs[i]) {
+                       kfree(rq->bufs[i]);
+                       rq->bufs[i] = NULL;
+               }
        }
 
        rq->ctrl = NULL;
index 122e33bcc57826a1ef08abf0337a3b97da014570..4b2a6c6a569be11752846674727e7fdfaf02133f 100644 (file)
@@ -77,8 +77,10 @@ void vnic_wq_free(struct vnic_wq *wq)
        vnic_dev_free_desc_ring(vdev, &wq->ring);
 
        for (i = 0; i < VNIC_WQ_BUF_BLKS_MAX; i++) {
-               kfree(wq->bufs[i]);
-               wq->bufs[i] = NULL;
+               if (wq->bufs[i]) {
+                       kfree(wq->bufs[i]);
+                       wq->bufs[i] = NULL;
+               }
        }
 
        wq->ctrl = NULL;