[PATCH] net: stmmac: loongson1: Use dev_err_probe()

From: Keguang Zhang via B4 Relay

Date: Mon Jun 15 2026 - 08:28:04 EST


From: Keguang Zhang <keguang.zhang@xxxxxxxxx>

Use dev_err_probe() for the missing match data case to simplify
error handling.

Signed-off-by: Keguang Zhang <keguang.zhang@xxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
index de9aba756aac..ec34adb63f61 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
@@ -176,10 +176,8 @@ static int ls1x_dwmac_probe(struct platform_device *pdev)
"Unable to find syscon\n");

data = of_device_get_match_data(&pdev->dev);
- if (!data) {
- dev_err(&pdev->dev, "No of match data provided\n");
- return -EINVAL;
- }
+ if (!data)
+ return dev_err_probe(&pdev->dev, -EINVAL, "No of match data provided\n");

dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
if (!dwmac)

---
base-commit: ec039126b7fac4e3af35ebccaa7c6f9b6875ba81
change-id: 20260602-dwmac-loongson1-5e1b9dfc3c62

Best regards,
--
Keguang Zhang <keguang.zhang@xxxxxxxxx>