From: Long Wu <long...@corigine.com>

CI found that calling "rte_pci_write_config" without
checking return value.

Coverity issue: 403100
Fixes: 1fbe51cd9c3a ("net/nfp: extend usage of BAR from 8 to 24")
Cc: chaoyong...@corigine.com
Cc: sta...@dpdk.org

Signed-off-by: Long Wu <long...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
Reviewed-by: Peng Zhang <peng.zh...@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp6000_pcie.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp6000_pcie.c 
b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
index 13cf523506..a6fd89b6c8 100644
--- a/drivers/net/nfp/nfpcore/nfp6000_pcie.c
+++ b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
@@ -214,8 +214,9 @@ nfp_bar_write(struct nfp_pcie_user *nfp,
                rte_read32(nfp->csr + xbar);
        } else {
                xbar += nfp->dev_info->pcie_cfg_expbar_offset;
-               rte_pci_write_config(nfp->pci_dev, &newcfg, sizeof(uint32_t),
-                               xbar);
+               if (rte_pci_write_config(nfp->pci_dev, &newcfg, 
sizeof(uint32_t),
+                               xbar) < 0)
+                       return -EIO;
        }
 
        bar->barcfg = newcfg;
@@ -379,7 +380,8 @@ nfp_enable_bars(struct nfp_pcie_user *nfp)
        bar = &nfp->bar[0];
        bar->lock = true;
 
-       nfp_bar_write(nfp, bar, barcfg_msix_general);
+       if (nfp_bar_write(nfp, bar, barcfg_msix_general) < 0)
+               return -EIO;
 
        /* Sort bars by bit size - use the smallest possible first. */
        qsort(&nfp->bar[0], nfp->bars, sizeof(nfp->bar[0]), nfp_cmp_bars);
-- 
2.39.1

Reply via email to