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


Groups > linux.kernel > #1435181

[PATCH v2 09/15] [media] lirc_dev: merge three if statements in only one

From Andi Shyti <andi.shyti@samsung.com>
Newsgroups linux.kernel
Subject [PATCH v2 09/15] [media] lirc_dev: merge three if statements in only one
Date 2016-07-01 11:20 +0200
Message-ID <rQ2M9-4Op-13@gated-at.bofh.it> (permalink)
References <rQ1Gp-4bf-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The three if statements check the same thing, merge them in only
one statement.

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

diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 2643336..d98a9f1 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -270,15 +270,10 @@ static int lirc_allocate_driver(struct lirc_driver *d)
 			dev_err(d->dev, "add_to_buf not set\n");
 			return -EBADRQC;
 		}
-	} else if (!(d->fops && d->fops->read) && !d->rbuf) {
-		dev_err(d->dev, "fops->read and rbuf are NULL!\n");
+	} else if (!d->rbuf && !(d->fops && d->fops->read &&
+				d->fops->poll && d->fops->unlocked_ioctl)) {
+		dev_err(d->dev, "undefined read, poll, ioctl\n");
 		return -EBADRQC;
-	} else if (!d->rbuf) {
-		if (!(d->fops && d->fops->read && d->fops->poll &&
-		      d->fops->unlocked_ioctl)) {
-			dev_err(d->dev, "undefined read, poll, ioctl\n");
-			return -EBADRQC;
-		}
 	}
 
 	mutex_lock(&lirc_dev_lock);
-- 
2.8.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/15] lirc_dev fixes and beautification Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:20 +0200
  [PATCH v2 14/15] [media] lirc_dev: fix potential segfault Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:30 +0200
  [PATCH v2 02/15] [media] lirc_dev: allow bufferless driver registration Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:30 +0200
    Re: [PATCH v2 02/15] [media] lirc_dev: allow bufferless driver  registration Sean Young <sean@mess.org> - 2016-07-02 19:20 +0200
  [PATCH v2 12/15] [media] lirc_dev: fix error return value Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:40 +0200
    Re: [PATCH v2 12/15] [media] lirc_dev: fix error return value Hans Verkuil <hverkuil@xs4all.nl> - 2016-07-04 13:50 +0200
  [PATCH v2 11/15] [media] lirc_dev: fix variable constant comparisons Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 10:40 +0200
  [PATCH v2 09/15] [media] lirc_dev: merge three if statements in only  one Andi Shyti <andi.shyti@samsung.com> - 2016-07-01 11:20 +0200

csiph-web