From 121c4df03b3039245470e62e04bbd1f433de8aee Mon Sep 17 00:00:00 2001
From: Richard Oliver <richard.oliver@raspberrypi.com>
Date: Tue, 25 Feb 2025 15:22:46 +0000
Subject: [PATCH] spi: rp2040-gpio-bridge: fix gpiod error handling

In some circumstances, devm_gpiod_get_array_optional() can return
PTR_ERR rather than NULL to indicate failure. Handle these cases.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
---
 drivers/spi/spi-rp2040-gpio-bridge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/spi/spi-rp2040-gpio-bridge.c
+++ b/drivers/spi/spi-rp2040-gpio-bridge.c
@@ -956,7 +956,8 @@ static void rp2040_gbdg_parse_dt(struct
 
 	rp2040_gbdg->fast_xfer_gpios =
 		devm_gpiod_get_array_optional(dev, "fast_xfer", GPIOD_ASIS);
-	if (!rp2040_gbdg->fast_xfer_gpios) {
+	if (IS_ERR_OR_NULL(rp2040_gbdg->fast_xfer_gpios)) {
+		rp2040_gbdg->fast_xfer_gpios = NULL;
 		dev_info(dev, "Could not acquire fast_xfer-gpios\n");
 		goto node_put;
 	}
