Skip to contentSkip to conversation

EDAC/versalnet: Fix error code in probe()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 18, 2025

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

PATCH 1/1 EDAC/versalnet: Fix error code in probe()

This code returns success if devm_kzalloc() fails. Return -ENOMEM instead.

Fixes d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR controller")
---
 drivers/edac/versalnet_edac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/edac/versalnet_edac.c +3 -1
index 66714fffa591..7c5db8bf0595 100644
@@ -888,8 +888,10 @@ static int mc_probe(struct platform_device *pdev)
 	}
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
+	if (!priv) {
+		rc = -ENOMEM;
 		goto err_alloc;
+	}
 
 	amd_rpmsg_id_table[0].driver_data = (kernel_ulong_t)priv;
 
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw
Quoted 16 lines · Dan Carpenter

This code returns success if devm_kzalloc() fails. Return -ENOMEM instead.

Fixes d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR controller")
---
 drivers/edac/versalnet_edac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/edac/versalnet_edac.c +0 -0
index 66714fffa591..7c5db8bf0595 100644
@@ -888,8 +888,10 @@ static int mc_probe(struct platform_device *pdev)
 	}

drivers/edac/versalnet_edac.c static int mc_probe(struct platform_device *pdev) · line 897

Quoted 10 lines
drivers/edac/versalnet_edac.c +3 -1
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
+	if (!priv) {
+		rc = -ENOMEM;
 		goto err_alloc;
+	}
 
 	amd_rpmsg_id_table[0].driver_data = (kernel_ulong_t)priv;
 

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette