netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	"Jonathan Currier" <dullfire@yahoo.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Shuah Khan" <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] nui: Fix dma_mapping_error() check
Date: Mon, 30 Jun 2025 18:09:06 +0100	[thread overview]
Message-ID: <20250630170906.GN41770@horms.kernel.org> (raw)
In-Reply-To: <20250630083650.47392-2-fourier.thomas@gmail.com>

On Mon, Jun 30, 2025 at 10:36:43AM +0200, Thomas Fourier wrote:
> dma_map_XXX() functions return values DMA_MAPPING_ERROR as error values
> which is often ~0.  The error value should be tested with
> dma_mapping_error().
> 
> This patch creates a new function in niu_ops to test if the mapping
> failed.  The test is fixed in niu_rbr_add_page(), added in
> niu_start_xmit() and the successfully mapped pages are unmaped upon error.
> 
> Fixes: ec2deec1f352 ("niu: Fix to check for dma mapping errors.")

I think it fixes a bit more than that.
But perhaps the above tag is sufficient.

> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>

Overall this looks good to me, thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>

> ---
>  drivers/net/ethernet/sun/niu.c | 31 ++++++++++++++++++++++++++++++-
>  drivers/net/ethernet/sun/niu.h |  4 ++++
>  2 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c

...

> @@ -10019,6 +10042,11 @@ static void niu_phys_unmap_single(struct device *dev, u64 dma_address,
>  	/* Nothing to do.  */
>  }
>  
> +static int niu_phys_mapping_error(struct device *dev, u64 dma_address)
> +{
> +	return false;

No need to resend just because of this, but
from a type PoV this should probably be:

	return 0;

> +}
> +
>  static const struct niu_ops niu_phys_ops = {
>  	.alloc_coherent	= niu_phys_alloc_coherent,
>  	.free_coherent	= niu_phys_free_coherent,

...

  reply	other threads:[~2025-06-30 17:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  8:36 [PATCH net v2] nui: Fix dma_mapping_error() check Thomas Fourier
2025-06-30 17:09 ` Simon Horman [this message]
2025-07-02 11:10 ` patchwork-bot+netdevbpf

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=20250630170906.GN41770@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dullfire@yahoo.com \
    --cc=edumazet@google.com \
    --cc=fourier.thomas@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).