From patchwork Wed Jun 29 13:20:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9205087 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 A2A00607D8 for ; Wed, 29 Jun 2016 13:22:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 951AE28668 for ; Wed, 29 Jun 2016 13:22:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87DA628666; Wed, 29 Jun 2016 13:22:57 +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 326F228666 for ; Wed, 29 Jun 2016 13:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752773AbcF2NWG (ORCPT ); Wed, 29 Jun 2016 09:22:06 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:56899 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752593AbcF2NVF (ORCPT ); Wed, 29 Jun 2016 09:21:05 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O9J00TPDBQXM300@mailout4.samsung.com>; Wed, 29 Jun 2016 22:20:57 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id F0.6E.05161.93BC3775; Wed, 29 Jun 2016 22:20:57 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-20-5773cb392191 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id E3.6D.04429.83BC3775; Wed, 29 Jun 2016 06:20:57 -0700 (MST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O9J0087XBQTVM50@mmp1.samsung.com>; Wed, 29 Jun 2016 22:20:56 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH 09/15] lirc_dev: merge three if statements in only one Date: Wed, 29 Jun 2016 22:20:38 +0900 Message-id: <1467206444-9935-10-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1467206444-9935-1-git-send-email-andi.shyti@samsung.com> References: <1467206444-9935-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsWyRsSkUNfydHG4we3vnBbbjzxjtVj84zmT xeVdc9gsejZsZbVY/azCgdXj+pJPzB5b+u+ye/RtWcXo8XmTXABLFJdNSmpOZllqkb5dAlfG /qvbmQpuc1Ss+/eXqYGxh72LkZNDQsBE4u3kbihbTOLCvfVsXYxcHEICKxglelrWwxV1PnvK CJFYyiix8PInJgjnI6PEpFPf2UCq2AQ0JZpu/wCyOThEBIwlzv1QBwkzCzQzSuy+bgRiCwu4 SfS29jOC2CwCqhIPOjeygNi8QPHdW+4xQiyTk7g8/QHYSE6g+PLzN8GOEBJwlWh9+h/sCAmB ZnaJExd/skEMEpD4NvkQC8heCQFZiU0HmCHmSEocXHGDZQKj8AJGhlWMoqkFyQXFSelFxnrF ibnFpXnpesn5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78tq2qS3lc3r/Sql8va7RjtU0ju1jF520xV+bb+/p5v98+u3dP bpLIjtcvVn0oWDst2/euc/dJfiWW4oxEQy3mouJEAKoWSSSrAgAA 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 7dff92c..0c26609 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -269,15 +269,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);