Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19e56539 authored by Andi Shyti's avatar Andi Shyti Committed by Mauro Carvalho Chehab
Browse files

[media] lirc_dev: simplify if statement in lirc_add_to_buf



The whole function is inside an 'if' statement
("if (ir->d.add_to_buf)").

Check the opposite of that statement at the beginning and exit,
this way we can have one level less of indentation.

Signed-off-by: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7fe579d2
Loading
Loading
Loading
Loading
+15 −16
Original line number Original line Diff line number Diff line
@@ -97,10 +97,12 @@ static void lirc_irctl_cleanup(struct irctl *ir)
 */
 */
static int lirc_add_to_buf(struct irctl *ir)
static int lirc_add_to_buf(struct irctl *ir)
{
{
	if (ir->d.add_to_buf) {
	int res;
		int res = -ENODATA;
	int got_data = -1;
	int got_data = -1;


	if (!ir->d.add_to_buf)
		return 0;

	/*
	/*
	 * service the device as long as it is returning
	 * service the device as long as it is returning
	 * data and we have space
	 * data and we have space
@@ -116,9 +118,6 @@ static int lirc_add_to_buf(struct irctl *ir)
	return got_data ? 0 : res;
	return got_data ? 0 : res;
}
}


	return 0;
}

/* main function of the polling thread
/* main function of the polling thread
 */
 */
static int lirc_thread(void *irctl)
static int lirc_thread(void *irctl)