From patchwork Fri Jul 1 08:01:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9209577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64C3160752 for ; Fri, 1 Jul 2016 09:24:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549AE2842C for ; Fri, 1 Jul 2016 09:24:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4931928529; Fri, 1 Jul 2016 09:24:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BD772842C for ; Fri, 1 Jul 2016 09:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbcGAJQB (ORCPT ); Fri, 1 Jul 2016 05:16:01 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:38882 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbcGAJP7 (ORCPT ); Fri, 1 Jul 2016 05:15:59 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O9M033DVMAZZKB0@mailout2.samsung.com>; Fri, 01 Jul 2016 17:01:47 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 0F.13.05160.B6326775; Fri, 1 Jul 2016 17:01:47 +0900 (KST) X-AuditID: cbfee68e-f79266d000001428-b3-5776236b95ef Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 61.19.04429.B6326775; Fri, 1 Jul 2016 01:01:47 -0700 (MST) Received: from samsunx.samsung ([10.113.63.54]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O9M00G9YMAVFJA0@mmp2.samsung.com>; Fri, 01 Jul 2016 17:01:47 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab Cc: Joe Perches , Sean Young , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH v2 09/15] [media] lirc_dev: merge three if statements in only one Date: Fri, 01 Jul 2016 17:01:32 +0900 Message-id: <1467360098-12539-10-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1467360098-12539-1-git-send-email-andi.shyti@samsung.com> References: <1467360098-12539-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWyRsSkUDdbuSzc4NgORYvtR56xWiz+8ZzJ Yvb9xywWl3fNYbPo2bCV1WL1swqLhU+/sziwe1xf8onZY8kba48t/XfZPb6susbs0bdlFaPH 501yAWxRXDYpqTmZZalF+nYJXBmN92awFdzmqFg04S57A2MPexcjJ4eEgIlE3/SPTBC2mMSF e+vZuhi5OIQEVjBKTPs/B65o3plvbCC2kMAsRokbz0Mgij4ySqze3scIkmAT0JRouv0DqIiD Q0TAWOLcD3WQMLPAAUaJ3m4XEFtYIFhi3cUusJksAqoSMxavYAYp5xVwl3h03BFilZzE5ekP wFZxAoXvvtvFCLHWTWLurnvsIGslBOaxS9zufsMEMUdA4tvkQywgcyQEZCU2HWCGmCMpcXDF DZY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/mKF74Z5W1ZOLzS7lyedOCPzymTHv2n39zrAp 7O/YNKXErn379kjvtuGt2l33ft4JbDn2L4tjiQsr21wWLoM1GSVvi40LrHqTDT+5Rm8vsem/ 7Jm9p0Zc1zl0UaVi2WebXRfbTsnzq5UviHzgNPX2xKSrt5iKmpRYijMSDbWYi4oTAYO0UQ28 AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The three if statements check the same thing, merge them in only one statement. Signed-off-by: Andi Shyti --- 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);