]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
imx-media-of: avoid uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Wed, 4 Oct 2017 13:34:55 +0000 (15:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:56:01 +0000 (11:56 +0200)
Replaces upstream commit 0b2e9e7947e7 ("media: staging/imx: remove
confusing IS_ERR_OR_NULL usage")

We get a harmless warning about a potential uninitialized variable
use in the driver:

drivers/staging/media/imx/imx-media-of.c: In function 'of_parse_subdev':
drivers/staging/media/imx/imx-media-of.c:216:4: warning: 'remote_np' may be used uninitialized in this function [-Wmaybe-uninitialized]

I reworked that code to be easier to understand by gcc in mainline,
but that commit is too large to backport. This is a much simpler
workaround, avoiding the warning by adding a fake initialization
to the variable. The driver was only introduced in linux-4.13,
so the workaround is not needed for earlier stable kernels.

Fixes: e130291212df ("[media] media: Add i.MX media core driver")
Cc: stable@vger.kernel.org
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Steve Longerbeam <steve_longerbeam@mentor.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/imx/imx-media-of.c

index b026fe66467c4cfb394bac8db3593f632b49be89..90e7e702a411c6eaf0588575f45de316e5936cb3 100644 (file)
@@ -167,7 +167,7 @@ of_parse_subdev(struct imx_media_dev *imxmd, struct device_node *sd_np,
                of_parse_sensor(imxmd, imxsd, sd_np);
 
        for (i = 0; i < num_pads; i++) {
-               struct device_node *epnode = NULL, *port, *remote_np;
+               struct device_node *epnode = NULL, *port, *remote_np = NULL;
                struct imx_media_subdev *remote_imxsd;
                struct imx_media_pad *pad;
                int remote_pad;