vdpa/mlx5: support device cleanup callback
[dpdk.git] / drivers / vdpa / ifc / ifcvf_vdpa.c
index dd5251d..9f05595 100644 (file)
@@ -17,7 +17,7 @@
 #include <rte_bus_pci.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
-#include <rte_vdpa_dev.h>
+#include <vdpa_driver.h>
 #include <rte_vfio.h>
 #include <rte_spinlock.h>
 #include <rte_log.h>
@@ -226,8 +226,7 @@ ifcvf_dma_map(struct ifcvf_internal *internal, bool do_map)
        }
 
 exit:
-       if (mem)
-               free(mem);
+       free(mem);
        return ret;
 }
 
@@ -253,8 +252,7 @@ hva_to_gpa(int vid, uint64_t hva)
        }
 
 exit:
-       if (mem)
-               free(mem);
+       free(mem);
        return gpa;
 }
 
@@ -661,8 +659,7 @@ m_ifcvf_start(struct ifcvf_internal *internal)
 
 error:
        for (i = 0; i < nr_vring; i++)
-               if (internal->m_vring[i].desc)
-                       rte_free(internal->m_vring[i].desc);
+               rte_free(internal->m_vring[i].desc);
 
        return -1;
 }