From ee05a93e1e6633d0fdec409faf09f12a2e05b991 Mon Sep 17 00:00:00 2001 From: Tomasz Duszynski Date: Tue, 22 Feb 2022 09:28:17 +0100 Subject: [PATCH] raw/cnxk_gpio: check pointer before use in self test Even though nonexistent cnxk_gpio is unlikely at this point it's a good practice to check pointers before using them. Fixes: 0e6557b448fa ("raw/cnxk_gpio: add self test") Coverity issue: 376502 Signed-off-by: Tomasz Duszynski Reviewed-by: Jerin Jacob --- drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c b/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c index 7fccc48f30..acb65afa65 100644 --- a/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c +++ b/drivers/raw/cnxk_gpio/cnxk_gpio_selftest.c @@ -311,6 +311,8 @@ cnxk_gpio_selftest(uint16_t dev_id) int ret, ret2; rawdev = rte_rawdev_pmd_get_named_dev("cnxk_gpio"); + if (!rawdev) + return -ENODEV; gpiochip = rawdev->dev_private; queues = rte_rawdev_queue_count(dev_id);