]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: st-mipid02: add a check for devm_gpiod_get_optional
authorChuhong Yuan <hslester96@gmail.com>
Fri, 18 Oct 2019 01:46:56 +0000 (22:46 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 21:48:35 +0000 (18:48 -0300)
mipid02_probe misses a check for devm_gpiod_get_optional and may miss
the failure.
Add a check to fix the problem.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/st-mipid02.c

index 81285b8d5cfbe6435e5f19a9b4170cdf271e834a..003ba22334cdff083db53d0983fd323bdcc50878 100644 (file)
@@ -971,6 +971,11 @@ static int mipid02_probe(struct i2c_client *client)
        bridge->reset_gpio = devm_gpiod_get_optional(dev, "reset",
                                                     GPIOD_OUT_HIGH);
 
+       if (IS_ERR(bridge->reset_gpio)) {
+               dev_err(dev, "failed to get reset GPIO\n");
+               return PTR_ERR(bridge->reset_gpio);
+       }
+
        ret = mipid02_get_regulators(bridge);
        if (ret) {
                dev_err(dev, "failed to get regulators %d", ret);