]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: imx334: 'ret' is uninitialized, should have been PTR_ERR()
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 8 Feb 2021 11:32:29 +0000 (12:32 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 9 Feb 2021 14:14:02 +0000 (15:14 +0100)
Fix this compiler warning:

drivers/media/i2c/imx334.c: In function 'imx334_parse_hw_config':
include/linux/dev_printk.h:112:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
  112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
      |  ^~~~~~~~
drivers/media/i2c/imx334.c:783:6: note: 'ret' was declared here
  783 |  int ret;
      |      ^~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/imx334.c

index 07e31bc2ef18d09c9ee1d9dae290a7daaa97b8bf..ad530f0d338a1ef1bdd04c8b610f1f42272280ce 100644 (file)
@@ -790,7 +790,8 @@ static int imx334_parse_hw_config(struct imx334 *imx334)
        imx334->reset_gpio = devm_gpiod_get_optional(imx334->dev, "reset",
                                                     GPIOD_OUT_LOW);
        if (IS_ERR(imx334->reset_gpio)) {
-               dev_err(imx334->dev, "failed to get reset gpio %d", ret);
+               dev_err(imx334->dev, "failed to get reset gpio %ld",
+                       PTR_ERR(imx334->reset_gpio));
                return PTR_ERR(imx334->reset_gpio);
        }