[PATCH 2/3] media: i2c: ov2732: propagate GPIO errors

From: phucduc . bui

Date: Wed Oct 07 2026 - 07:35:04 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

devm_gpiod_get_optional() returns NULL when an optional GPIO is not
present, but may return -EPROBE_DEFER or other errors.

Check the return values and propagate errors from the powerdown and
reset GPIO lookups.

Fixes: 247b8b855876 ("media: i2c: Add ov2732 image sensor driver")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
drivers/media/i2c/ov2732.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/media/i2c/ov2732.c b/drivers/media/i2c/ov2732.c
index 40035320fec6..b8009c392d4d 100644
--- a/drivers/media/i2c/ov2732.c
+++ b/drivers/media/i2c/ov2732.c
@@ -665,9 +665,15 @@ static int ov2732_probe(struct i2c_client *client)
ov2732->powerdown_gpio = devm_gpiod_get_optional(ov2732->dev,
"powerdown",
GPIOD_OUT_HIGH);
+ if (IS_ERR(ov2732->powerdown_gpio))
+ return dev_err_probe(ov2732->dev, PTR_ERR(ov2732->powerdown_gpio),
+ "failed to get powerdown GPIO\n");

ov2732->reset_gpio = devm_gpiod_get_optional(ov2732->dev, "reset",
GPIOD_OUT_HIGH);
+ if (IS_ERR(ov2732->reset_gpio))
+ return dev_err_probe(ov2732->dev, PTR_ERR(ov2732->reset_gpio),
+ "failed to get reset GPIO\n");

ov2732->regmap = devm_cci_regmap_init_i2c(client, 16);
if (IS_ERR(ov2732->regmap))
--
2.43.0