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: 0e6557b448 ("raw/cnxk_gpio: add self test")
Coverity issue: 376502

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Tomasz Duszynski 2022-02-22 09:28:17 +01:00 committed by Thomas Monjalon
parent a8e1030905
commit ee05a93e1e

View File

@ -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);