From patchwork Sat Jul 23 07:42:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9244519 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 E200860757 for ; Sat, 23 Jul 2016 07:43:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1D0D2819A for ; Sat, 23 Jul 2016 07:43:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A390F281D2; Sat, 23 Jul 2016 07:43:03 +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 359102819A for ; Sat, 23 Jul 2016 07:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751049AbcGWHmr (ORCPT ); Sat, 23 Jul 2016 03:42:47 -0400 Received: from mout.web.de ([212.227.17.12]:52156 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbcGWHmq (ORCPT ); Sat, 23 Jul 2016 03:42:46 -0400 Received: from [192.168.1.2] ([78.53.49.29]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MTPel-1brdDv3sJD-00SQaI; Sat, 23 Jul 2016 09:42:29 +0200 Subject: [PATCH] IB/hfi1: Delete an unnecessary check before the function call "sc_return_credits" To: linux-rdma@vger.kernel.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Ira Weiny , Mike Marciniszyn , Sean Hefty References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> From: SF Markus Elfring Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Message-ID: Date: Sat, 23 Jul 2016 09:42:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:6vfMMI7NQ5AbFl5feO6TNc/quAJIat8n+2zIBLMTGkC8KS+pvyF Xcr3FVwl55KK6HaG5AG8Y1lUv7z/C1FJgkKIlMQ+94YyaGL4UExTP3wYiXZRZbNoVjOrsrq G87+5UHZLVRD9KMv1eGzvs4NAHQW9/xuPFbheR6ZG1/kaJBwcFyRHyNS/zDa0Po2iPkO27N +2OqaAnzV9l2stwwkhQMQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:YcoJb6/gXcs=:h6uDb+xIUah+jMWDl8tOf0 t/1aCSH7oiV5t+0F5cXEnpkwnqu5nDrDws/vkP9F5yiT8OkY9U/mXn6i2sEdNzue+ikRnCGQo 7hxlEXWuk9AdCeBT46rSwKW8bDDIw9RgeEgfDCbfwagNayiMLL4TNhVzA00uTVTu4QsidVMMr h/X6cPRYCcds1gAWa8j2vjwAgmJzaPZQ4dowhsHlaa6LgOcg5Kvy3mZidCRQa0zyYtjCgbCUf cqLmD6BePld4y0EXDxcsG9ajbu6VsySlPzapmfiQT4zJTgdSkaRbB/2xMjz39qGn96hxjPDam wiJUR0DYjZ1q04oESrxi9T5uZTWFSnq0yqpMac3T8G+h1Fq0Izmv2O3BVWJvv2BIy1dHWkqeH 0sY78PzTCK185urHNl3v6XqXGc23AplkNH09HvHQR7OM+rhaj+6I40RVbHu3FNraDbjXgu4vr OMcBpd0SQwioWQEcblxRjXhRUZ2BAXiiBEt3lqzEeOKLoIMl3CJiQh8OxGYBQAcoS2ah0IGWt a66whrHZdbLdeUiXnNoPl2uZyY86fDpYI2MwwzFGvrSuTnEs8Dxlw/bq1uALXoaGw5cqeiRHF e8rZcGsb1FBLx9/uqDKE3bwfUyimncc8JQGQHbWD1CfnCWdv2IZd76u+aiwOoNfcjEUx8mBQW HKIxDvJkTGqLUhLOzLx2ON5wsuuLugi9Vu/ifabsHu5ECHz2L/4XZgqNVOH8EHInt9OeAniem tR3IL48w4ocPXIReaBXzU8vuykn2MS/x0vhF6mmKHkzvWCfuhi2laSa3hspq78sKokZPOL89n mqai00r Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 23 Jul 2016 08:30:52 +0200 The sc_return_credits() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/hfi1/file_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index c702a00..32c19fa 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -228,7 +228,7 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd, sizeof(struct hfi1_base_info)); break; case HFI1_IOCTL_CREDIT_UPD: - if (uctxt && uctxt->sc) + if (uctxt) sc_return_credits(uctxt->sc); break;