Skip to contentSkip to conversation

media: v4l: async: Avoid a goto in loop implementation

PATCH New Sakari Ailus 1 participant 1 message Jul 29, 2023

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH 1/1 media: v4l: async: Avoid a goto in loop implementation

Replace a goto-based loop by a while loop.

---
 drivers/media/v4l2-core/v4l2-async.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +10 -14
index f465a0964adf..091e8cf4114b 100644
@@ -820,20 +820,16 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
 		if (!v4l2_dev)
 			continue;
 
-again:
-		asc = v4l2_async_find_match(notifier, sd);
-		if (!asc)
-			continue;
-
-		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asc);
-		if (ret)
-			goto err_unbind;
-
-		ret = v4l2_async_nf_try_complete(notifier);
-		if (ret)
-			goto err_unbind;
-
-		goto again;
+		while ((asc = v4l2_async_find_match(notifier, sd))) {
+			ret = v4l2_async_match_notify(notifier, v4l2_dev, sd,
+						      asc);
+			if (ret)
+				goto err_unbind;
+
+			ret = v4l2_async_nf_try_complete(notifier);
+			if (ret)
+				goto err_unbind;
+		}
 	}
 
 	/* None matched, wait for hot-plugging */
Signature · 1 line
2.39.2