[PATCH] wifi: wilc1000: propagate optional GPIO errors in SPI probe

From: Ziheng Wei

Date: Sun Nov 22 2026 - 11:05:12 EST


wilc_parse_gpios() treats ERR_PTR() from the optional enable and reset
GPIOs as valid descriptors. This loses errors such as -EPROBE_DEFER and
lets probe continue without the required power/reset sequence.

Propagate optional GPIO errors so probe deferral works correctly.

Found by LLM-assisted static analysis. Build tested with allmodconfig;
no runtime test on the affected hardware.

Fixes: ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ziheng Wei <zihengw03@xxxxxxx>
---
drivers/net/wireless/microchip/wilc1000/spi.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
index e40b829f7..97aad9ace 100644
--- a/drivers/net/wireless/microchip/wilc1000/spi.c
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -169,6 +169,9 @@ static int wilc_parse_gpios(struct wilc *wilc)
/* get ENABLE pin and deassert it (if it is defined): */
gpios->enable = devm_gpiod_get_optional(&spi->dev,
"enable", GPIOD_OUT_LOW);
+ if (IS_ERR(gpios->enable))
+ return PTR_ERR(gpios->enable);
+
/* get RESET pin and assert it (if it is defined): */
if (gpios->enable) {
/* if enable pin exists, reset must exist as well */
@@ -181,6 +184,8 @@ static int wilc_parse_gpios(struct wilc *wilc)
} else {
gpios->reset = devm_gpiod_get_optional(&spi->dev,
"reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(gpios->reset))
+ return PTR_ERR(gpios->reset);
}
return 0;
}

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0