All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koichiro Den <den@valinux.co.jp>
To: zhangjiao2 <zhangjiao2@cmss.chinamobile.com>
Cc: ntb@lists.linux.dev, linux@treblig.org, jdmason@kudzu.us,
	 linux-kernel@vger.kernel.org, trivial@kernel.org
Subject: Re: [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws()
Date: Wed, 25 Nov 2026 14:36:18 +0900	[thread overview]
Message-ID: <awZzH9bcH4SGYskT@z790sl> (raw)
In-Reply-To: <20261120084039.1954-1-zhangjiao2@cmss.chinamobile.com>

On Fri, Nov 20, 2026 at 04:40:39PM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@cmss.chinamobile.com>
> 
> 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@cmss.chinamobile.com>

I suppose the Fixes tag should be added, shouldn't it?

  Fixes: 26b3a37b9284 ("NTB: Introduce MSI library")

Otherwise, LGTM.

Reviewed-by: Koichiro Den <den@valinux.co.jp>

> ---
>  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
> 
> 
> 

      reply	other threads:[~2026-11-25  5:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  8:40 [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws() zhangjiao2
2026-11-25  5:36 ` Koichiro Den [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awZzH9bcH4SGYskT@z790sl \
    --to=den@valinux.co.jp \
    --cc=jdmason@kudzu.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=ntb@lists.linux.dev \
    --cc=trivial@kernel.org \
    --cc=zhangjiao2@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.