From bcbec86bf4ad54ed9fce89c254e921300c6918bb Mon Sep 17 00:00:00 2001 From: Zhaoming Luo Date: Mon, 7 Jul 2025 14:53:43 +0800 Subject: [PATCH] media: i2c: ov5647: replace devm_gpiod_get with devm_gpiod_get_optional This changed is based on the upstream source code[0]. When devm_gpiod_get is used, the driver may not be probed properly as 'pwdn' gpio may not exist. Therefore, devm_gpiod_get_optional is used so that the probe will not fail when the 'pwdn' gpio does not exist. [0]: https://github.com/torvalds/linux/blob/v6.1/drivers/media/i2c/ov5647.c#L1393 Signed-off-by: Zhaoming Luo Change-Id: I13339d2180d746d3bd6ee012fa25b370c3214370 --- drivers/media/i2c/ov5647.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index c6b358cca603..4c6f44551afe 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -1586,7 +1586,7 @@ static int ov5647_probe(struct i2c_client *client, } /* Request the power down GPIO asserted. */ - sensor->pwdn = devm_gpiod_get(dev, "pwdn", GPIOD_OUT_HIGH); + sensor->pwdn = devm_gpiod_get_optional(dev, "pwdn", GPIOD_OUT_HIGH); if (IS_ERR(sensor->pwdn)) { dev_err(dev, "Failed to get 'pwdn' gpio\n"); return -EINVAL;