[PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws()
From: zhangjiao2
Date: Fri Nov 20 2026 - 03:41:03 EST
From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
In the error_out cleanup path of ntb_msi_setup_mws(), the loop
iterates over the peers configured so far using the loop variable
'i', but ntb_peer_highest_mw_idx() is incorrectly passed 'peer'
(the index of the peer whose setup just failed) instead of 'i'.
As a result every iteration looks up the highest memory window of
the failing peer, so ntb_mw_clear_trans() clears the wrong window
index for each configured peer and the intended translations are
left enabled.
Fix it by passing the correct loop index 'i'.
Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
---
drivers/ntb/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ntb/msi.c b/drivers/ntb/msi.c
index 6817d504c12a..13e9f52ec8cc 100644
--- a/drivers/ntb/msi.c
+++ b/drivers/ntb/msi.c
@@ -154,7 +154,7 @@ int ntb_msi_setup_mws(struct ntb_dev *ntb)
error_out:
for (i = 0; i < peer; i++) {
- peer_widx = ntb_peer_highest_mw_idx(ntb, peer);
+ peer_widx = ntb_peer_highest_mw_idx(ntb, i);
if (peer_widx < 0)
continue;
--
2.33.0