[PATCH net-next] smsc911x: propagate reset GPIO errors
From: phucduc . bui
Date: Wed Oct 07 2026 - 08:49:43 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
devm_gpiod_get_optional() may return -EPROBE_DEFER or other errors,
but smsc911x_request_resources() currently does not handle them.
Check the return value and propagate errors from the reset GPIO lookup.
Release the regulators if they were successfully acquired before the
GPIO lookup failed.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
drivers/net/ethernet/smsc/smsc911x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 3ebd0664c697..41423baaf0af 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -439,6 +439,13 @@ static int smsc911x_request_resources(struct platform_device *pdev)
pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev,
"reset",
GPIOD_OUT_LOW);
+ if (IS_ERR(pdata->reset_gpiod)) {
+ if (!ret)
+ regulator_bulk_free(ARRAY_SIZE(pdata->supplies),
+ pdata->supplies);
+ return dev_err_probe(&pdev->dev, PTR_ERR(pdata->reset_gpiod),
+ "failed to get reset gpio\n");
+ }
/* Request clock */
pdata->clk = clk_get(&pdev->dev, NULL);
--
2.43.0