[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250630170906.GN41770@horms.kernel.org>
Date: Mon, 30 Jun 2025 18:09:06 +0100
From: Simon Horman <horms@...nel.org>
To: Thomas Fourier <fourier.thomas@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jonathan Currier <dullfire@...oo.com>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] nui: Fix dma_mapping_error() check
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@...il.com>
Overall this looks good to me, thanks for the update.
Reviewed-by: Simon Horman <horms@...nel.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,
...
Powered by blists - more mailing lists