* [PATCH net-next] net: lan966x: cleanup error handling in lan966x_fdma_rx_alloc_page_pool()
@ 2026-05-21 12:49 Dan Carpenter
2026-05-25 20:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-05-21 12:49 UTC (permalink / raw)
To: David Carlier, Horatiu Vultur
Cc: UNGLinuxDriver, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
kernel-janitors
This code works, but there are a few things to tidy up:
1. No need to an unlikely() because IS_ERR() already has an unlikely()
built in.
2. No need to use PTR_ERR_OR_ZERO() because it's not an error pointer.
3. Use the returned error code directly instead of using groveling in
rx->page_pool to find it.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
index f8ce735a7fc0..2d1c38289bb4 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
@@ -91,7 +91,7 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx)
pp_params.dma_dir = DMA_BIDIRECTIONAL;
rx->page_pool = page_pool_create(&pp_params);
- if (unlikely(IS_ERR(rx->page_pool)))
+ if (IS_ERR(rx->page_pool))
return PTR_ERR(rx->page_pool);
for (int i = 0; i < lan966x->num_phys_ports; ++i) {
@@ -106,7 +106,7 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx)
rx->page_pool);
}
- return PTR_ERR_OR_ZERO(rx->page_pool);
+ return 0;
}
static int lan966x_fdma_rx_alloc(struct lan966x_rx *rx)
@@ -115,8 +115,9 @@ static int lan966x_fdma_rx_alloc(struct lan966x_rx *rx)
struct fdma *fdma = &rx->fdma;
int err;
- if (lan966x_fdma_rx_alloc_page_pool(rx))
- return PTR_ERR(rx->page_pool);
+ err = lan966x_fdma_rx_alloc_page_pool(rx);
+ if (err)
+ return err;
err = fdma_alloc_coherent(lan966x->dev, fdma);
if (err) {
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: lan966x: cleanup error handling in lan966x_fdma_rx_alloc_page_pool()
2026-05-21 12:49 [PATCH net-next] net: lan966x: cleanup error handling in lan966x_fdma_rx_alloc_page_pool() Dan Carpenter
@ 2026-05-25 20:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-25 20:00 UTC (permalink / raw)
To: Dan Carpenter
Cc: devnexen, horatiu.vultur, UNGLinuxDriver, andrew+netdev, davem,
edumazet, kuba, pabeni, netdev, linux-kernel, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 21 May 2026 15:49:36 +0300 you wrote:
> This code works, but there are a few things to tidy up:
> 1. No need to an unlikely() because IS_ERR() already has an unlikely()
> built in.
> 2. No need to use PTR_ERR_OR_ZERO() because it's not an error pointer.
> 3. Use the returned error code directly instead of using groveling in
> rx->page_pool to find it.
>
> [...]
Here is the summary with links:
- [net-next] net: lan966x: cleanup error handling in lan966x_fdma_rx_alloc_page_pool()
https://git.kernel.org/netdev/net-next/c/640656c30a6a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-25 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 12:49 [PATCH net-next] net: lan966x: cleanup error handling in lan966x_fdma_rx_alloc_page_pool() Dan Carpenter
2026-05-25 20:00 ` patchwork-bot+netdevbpf
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).