[PATCH] NTB: epf: log teardown command failures with error code

Alok Tiwari <[email protected]> Tue, 7 Apr 2026 22:49:55 -0700
Newsgroups dev.linux.lists.ntb
Message-ID <[email protected]>
ntb_epf_mw_clear_trans() initializes ret to 0 and never updates it, so it
ignores failures from ntb_epf_send_command() and always returns 0.
Capture the command status, return it to the caller, and log the MW index
and error code on failure.

Fixes: 812ce2f8d14e ("NTB: Add support for EPF PCI Non-Transparent Bridge")
Signed-off-by: Alok Tiwari <[email protected]>
---
 drivers/ntb/hw/epf/ntb_hw_epf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
index d3ecf25a5162..0c8fc459eb7a 100644
--- a/drivers/ntb/hw/epf/ntb_hw_epf.c
+++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
@@ -438,11 +438,11 @@ static int ntb_epf_mw_clear_trans(struct ntb_dev *ntb, int pidx, int idx)
 {
 	struct ntb_epf_dev *ndev = ntb_ndev(ntb);
 	struct device *dev = ndev->dev;
-	int ret = 0;
+	int ret;
 
-	ntb_epf_send_command(ndev, CMD_TEARDOWN_MW, idx);
+	ret = ntb_epf_send_command(ndev, CMD_TEARDOWN_MW, idx);
 	if (ret)
-		dev_err(dev, "Failed to teardown memory window\n");
+		dev_err(dev, "Failed to teardown memory window %d err %d\n", idx, ret);
 
 	return ret;
 }
-- 
2.50.1