Skip to contentSkip to conversation

octeontx2-pf: Fix devm_kcalloc() error checking

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 1, 2025 – Nov 4, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 octeontx2-pf: Fix devm_kcalloc() error checking

The devm_kcalloc() function never return error pointers, it returns NULL on failure. Also delete the netdev_err() printk. These allocation functions already have debug output built-in some the extra error message is not required.

Fixes efabce290151 ("octeontx2-pf: AF_XDP zero copy receive support")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +2 -4
index 3378be87a473..75ebb17419c4 100644
@@ -1530,10 +1530,8 @@ int otx2_pool_aq_init(struct otx2_nic *pfvf, u16 pool_id,
 		pool->xdp_cnt = numptrs;
 		pool->xdp = devm_kcalloc(pfvf->dev,
 					 numptrs, sizeof(struct xdp_buff *), GFP_KERNEL);
-		if (IS_ERR(pool->xdp)) {
-			netdev_err(pfvf->netdev, "Creation of xsk pool failed\n");
-			return PTR_ERR(pool->xdp);
-		}
+		if (!pool->xdp)
+			return -ENOMEM;
 	}
 
 	return 0;
Signature · 1 line
2.51.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sat, 1 Nov 2025 16:26:42 +0300 you wrote:

The devm_kcalloc() function never return error pointers, it returns NULL on failure. Also delete the netdev_err() printk. These allocation functions already have debug output built-in some the extra error message is not required.

Fixes efabce290151 ("octeontx2-pf: AF_XDP zero copy receive support")

[...]

Here is the summary with links:
- [net] octeontx2-pf: Fix devm_kcalloc() error checking

    https://git.kernel.org/netdev/net/c/2e25935ed24d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html