dpaa_dev_init() jumped to the free_rx cleanup label without setting ret
when dpaa_port_fmc_init() failed:

        if (num_rx_fqs < 0) {
                DPAA_PMD_ERR("%s FMC initializes failed!", dpaa_intf->name);
                goto free_rx;
        }

ret is still 0 from its initializer at that point, so free_rx returned
success and the port was probed with no Rx queues at all. The adjacent
"not configured by FMC" case already sets -ENODEV before the same goto.

Propagate the error from dpaa_port_fmc_init() instead, and clear
num_rx_fqs so the cleanup path does not use the negative count when
releasing the CGRID range.

Fixes: f5fe3eed51d2 ("net/dpaa: support FMC parser for VSP")
Cc: [email protected]

Signed-off-by: Hemant Agrawal <[email protected]>
---
 drivers/net/dpaa/dpaa_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a5b02cc9a8..834476bd8a 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -2259,6 +2259,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
                if (num_rx_fqs < 0) {
                        DPAA_PMD_ERR("%s FMC initializes failed!",
                                dpaa_intf->name);
+                       ret = num_rx_fqs;
+                       num_rx_fqs = 0;
                        goto free_rx;
                }
                if (!num_rx_fqs) {
-- 
2.25.1

Reply via email to