]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: endpoint: pci-epf-vntb: Return -ENOENT if pci_epc_get_next_free_bar() fails
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 3 Jun 2025 17:03:38 +0000 (19:03 +0200)
committerManivannan Sadhasivam <mani@kernel.org>
Mon, 23 Jun 2025 12:03:19 +0000 (06:03 -0600)
According the function documentation of epf_ntb_init_epc_bar(), the
function should return an error code on error. However, it returns -1 when
no BAR is available i.e., when pci_epc_get_next_free_bar() fails.

Return -ENOENT instead.

Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
[mani: changed err code to -ENOENT]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250603-pci-vntb-bar-mapping-v2-1-fc685a22ad28@baylibre.com
drivers/pci/endpoint/functions/pci-epf-vntb.c

index e4da3fdb000723e3adad01f0ddf230ecc0e572a7..30c6c563335a2c3b224cbe960960a2252d570ac7 100644 (file)
@@ -680,7 +680,7 @@ static int epf_ntb_init_epc_bar(struct epf_ntb *ntb)
                barno = pci_epc_get_next_free_bar(epc_features, barno);
                if (barno < 0) {
                        dev_err(dev, "Fail to get NTB function BAR\n");
-                       return barno;
+                       return -ENOENT;
                }
                ntb->epf_ntb_bar[bar] = barno;
        }