[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250702200812.GI41770@horms.kernel.org>
Date: Wed, 2 Jul 2025 21:08:12 +0100
From: Simon Horman <horms@...nel.org>
To: Thomas Fourier <fourier.thomas@...il.com>
Cc: Chris Snook <chris.snook@...il.com>,
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>,
Oleksij Rempel <o.rempel@...gutronix.de>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: ag71xx: Add missing check after DMA map
On Wed, Jul 02, 2025 at 09:50:46AM +0200, Thomas Fourier wrote:
> The DMA map functions can fail and should be tested for errors.
>
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Thomas Fourier <fourier.thomas@...il.com>
> ---
> drivers/net/ethernet/atheros/ag71xx.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
> index d8e6f23e1432..0e68ab225e0a 100644
> --- a/drivers/net/ethernet/atheros/ag71xx.c
> +++ b/drivers/net/ethernet/atheros/ag71xx.c
> @@ -1198,7 +1198,8 @@ static int ag71xx_buffer_size(struct ag71xx *ag)
>
> static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf,
> int offset,
> - void *(*alloc)(unsigned int size))
> + void *(*alloc)(unsigned int size),
> + void (*free)(void *))
FWIIW, I'm of two minds about this free parameter.
On the one hand I like the symmetry with free.
But on the other the two callers both pass
skb_free_frag as this argument.
But I lean towards what you have being a good choice.
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists