]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/infiniband/hw/hns/hns_roce_hw_v2.c
RDMA/hns: Prevent memory leaks of eq->buf_list
[linux.git] / drivers / infiniband / hw / hns / hns_roce_hw_v2.c
index 7a89d669f8bfa93265228c855d233a48cd5f5cf6..e82567fcdeb7f05c46110a77176d50563ee3e10f 100644 (file)
@@ -5389,9 +5389,9 @@ static void hns_roce_v2_free_eq(struct hns_roce_dev *hr_dev,
                return;
        }
 
-       if (eq->buf_list)
-               dma_free_coherent(hr_dev->dev, buf_chk_sz,
-                                 eq->buf_list->buf, eq->buf_list->map);
+       dma_free_coherent(hr_dev->dev, buf_chk_sz, eq->buf_list->buf,
+                         eq->buf_list->map);
+       kfree(eq->buf_list);
 }
 
 static void hns_roce_config_eqc(struct hns_roce_dev *hr_dev,