Skip to contentSkip to conversation

imx-media-of: avoid uninitialized variable warning

PATCH Applied Arnd Bergmann 3 participants 3 messages Oct 4, 2017 – Oct 5, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx-media-of: avoid uninitialized variable warning

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 Philipp Zabel <[email protected]>
Cc Steve Longerbeam <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/staging/media/imx/imx-media-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-of.c +1 -1
index b026fe66467c..90e7e702a411 100644
@@ -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;
Signature · 1 line
2.9.0
maintainer Applied
#1 lore raw

Patch "[media] imx-media-of: avoid uninitialized variable warning" has been added to the 4.13-stable tree

This is a note to let you know that I've just added the patch titled

[media] imx-media-of: avoid uninitialized variable warning

to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
imx-media-of-avoid-uninitialized-variable-warning.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From [email protected] Thu Oct 5 11:08:57 2017

From: Arnd Bergmann <[email protected]>
Date: Wed, 4 Oct 2017 15:34:55 +0200
Subject: [media] imx-media-of: avoid uninitialized variable warning
To: Greg Kroah-Hartman <[email protected]>
Cc: Arnd Bergmann <[email protected]>, [email protected], Philipp Zabel <[email protected]>, Steve Longerbeam <[email protected]>, Hans Verkuil <[email protected]>, Mauro Carvalho Chehab <[email protected]>, Steve Longerbeam <[email protected]>, Mauro Carvalho Chehab <[email protected]>, Russell King <[email protected]>, [email protected], [email protected], [email protected]
Message-ID: <[email protected]>

From: Arnd Bergmann <[email protected]>

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 Philipp Zabel <[email protected]>
Cc Steve Longerbeam <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/staging/media/imx/imx-media-of.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-of.c +1 -1
@@ -167,7 +167,7 @@ of_parse_subdev(struct imx_media_dev *im
 		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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.13/imx-media-of-avoid-uninitialized-variable-warning.patch

#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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]

Quoted 7 lines

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")

I normally leave off the Fixes tag when it's not a bugfix. The warning is, as you mentioned, harmless.

regards,
dan carpenter