device.devargs can be null, don't access device.devargs->args without
null check.

Fixes: e0645348d7c6 ("net/i40e: add support for representor ports")

Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>
---
Cc: declan.dohe...@intel.com
---
 drivers/net/i40e/i40e_ethdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6dbea439f..afa9a1c13 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -623,9 +623,12 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv 
__rte_unused,
        struct rte_eth_devargs eth_da = { .nb_representor_ports = 0 };
        int i, retval;
 
-       retval = rte_eth_devargs_parse(pci_dev->device.devargs->args, &eth_da);
-       if (retval)
-               return retval;
+       if (pci_dev->device.devargs) {
+               retval = rte_eth_devargs_parse(pci_dev->device.devargs->args,
+                               &eth_da);
+               if (retval)
+                       return retval;
+       }
 
        /* physical port net_bdf_port */
        snprintf(name, sizeof(name), "net_%s", pci_dev->device.name);
-- 
2.14.3

Reply via email to