aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-11-01 08:54:58 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-11 13:04:50 -0500
commit79c5453d3e3e7de9e5ce5c88af29b34688dd0469 (patch)
tree5b219cc95205b128ca3f1e8d447ddc9190cd66ff /drivers
parentmedia: em28xx: Fix use-after-free when disconnecting (diff)
downloadlinux-dev-79c5453d3e3e7de9e5ce5c88af29b34688dd0469.tar.xz
linux-dev-79c5453d3e3e7de9e5ce5c88af29b34688dd0469.zip
media: atmel-isc: avoid returning a random value at isc_parse_dt()
As warned by smatch: drivers/media/platform/atmel/atmel-isc.c:2097 isc_parse_dt() error: uninitialized symbol 'ret'. The problem here is that of_graph_get_next_endpoint() can potentially return NULL on its first pass, with would make it return a random value, as ret is not initialized. While here, use while(1) instead of for(; ;), as while is the preferred syntax for such kind of loops. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/atmel/atmel-isc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index 13f1c1c797b0..0c2635647f69 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -2039,10 +2039,10 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
INIT_LIST_HEAD(&isc->subdev_entities);
- for (; ;) {
+ while (1) {
epn = of_graph_get_next_endpoint(np, epn);
if (!epn)
- break;
+ return 0;
rem = of_graph_get_remote_port_parent(epn);
if (!rem) {