Hi Hernan,

On 8/20/22 04:31, Hernan Vargas wrote:
Move check for undefined device before allocating queue data structure.

Coverity issue: 375803, 375813, 375819, 375827, 375831
Fixes: 060e7672930 ("baseband/acc100: add queue configuration")
Cc: sta...@dpdk.org

Please add fixes at the beginning of the series to ease back-porting by
LTS maintainers.

Signed-off-by: Hernan Vargas <hernan.var...@intel.com>
---
  drivers/baseband/acc100/rte_acc100_pmd.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c 
b/drivers/baseband/acc100/rte_acc100_pmd.c
index 349b8be5c1..586d06d1b3 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -828,6 +828,10 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t 
queue_id,
        struct acc100_queue *q;
        int16_t q_idx;
+ if (d == NULL) {
+               rte_bbdev_log(ERR, "Undefined device");
+               return -ENODEV;
+       }
        /* Allocate the queue data structure. */
        q = rte_zmalloc_socket(dev->device->driver->name, sizeof(*q),
                        RTE_CACHE_LINE_SIZE, conf->socket);
@@ -835,10 +839,6 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t 
queue_id,
                rte_bbdev_log(ERR, "Failed to allocate queue memory");
                return -ENOMEM;
        }
-       if (d == NULL) {
-               rte_bbdev_log(ERR, "Undefined device");
-               return -ENODEV;
-       }
q->d = d;
        q->ring_addr = RTE_PTR_ADD(d->sw_rings, (d->sw_ring_size * queue_id));

With patch reordering done:
Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>

Thanks,
Maxime

Reply via email to