Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1435125 > unrolled thread

[PATCH v2 06/15] [media] lirc_dev: do not use goto to create loops

Started byAndi Shyti <andi.shyti@samsung.com>
First post2016-07-01 10:20 +0200
Last post2016-07-01 10:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 06/15] [media] lirc_dev: do not use goto to create loops Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:20 +0200

#1435125 — [PATCH v2 06/15] [media] lirc_dev: do not use goto to create loops

FromAndi Shyti <andi.shyti@samsung.com>
Date2016-07-01 10:20 +0200
Subject[PATCH v2 06/15] [media] lirc_dev: do not use goto to create loops
Message-ID<rQ1Q6-4fw-29@gated-at.bofh.it>
... use "do .. while" instead.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/media/rc/lirc_dev.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 0d988c9..da1777c 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -99,18 +99,16 @@ static int lirc_add_to_buf(struct irctl *ir)
 {
 	if (ir->d.add_to_buf) {
 		int res = -ENODATA;
-		int got_data = 0;
+		int got_data = -1;
 
 		/*
 		 * service the device as long as it is returning
 		 * data and we have space
 		 */
-get_data:
-		res = ir->d.add_to_buf(ir->d.data, ir->buf);
-		if (res == 0) {
+		do {
 			got_data++;
-			goto get_data;
-		}
+			res = ir->d.add_to_buf(ir->d.data, ir->buf);
+		} while (!res);
 
 		if (res == -ENODEV)
 			kthread_stop(ir->task);
-- 
2.8.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web