From patchwork Thu Feb 5 12:26:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5784211 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6FFF1BF440 for ; Thu, 5 Feb 2015 12:27:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79DC62011D for ; Thu, 5 Feb 2015 12:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABDC2200E8 for ; Thu, 5 Feb 2015 12:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752232AbbBEM1S (ORCPT ); Thu, 5 Feb 2015 07:27:18 -0500 Received: from mout.web.de ([212.227.15.4]:59425 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbbBEM1R (ORCPT ); Thu, 5 Feb 2015 07:27:17 -0500 Received: from [192.168.1.2] ([92.228.134.1]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LgYi5-1XpUow36JR-00nyUM; Thu, 05 Feb 2015 13:27:00 +0100 Message-ID: <54D36190.1050407@users.sourceforge.net> Date: Thu, 05 Feb 2015 13:26:56 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Bart Van Assche , Hal Rosenstock , Roland Dreier , Sean Hefty , linux-rdma@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] InfiniBand: Delete unnecessary checks before the function, call "srp_destroy_fr_pool" 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:dKZbE8o57z9KEEQN/W9fMykrg3L564oUfK37oLaupCPQfV2VLqX CfU02SMqAOphBmo6t3HniFY2/K0GcIkoU3zhxZnIVgMIEyjeERrGGdRHoMVx9/cEoxcxYr+ vgOtz/L0p9FHtkqxRkDVQbI3c8lf3cPK0wZUKBd9l2KMdBJ1Ger7AhJVooYP3Y5dWs+AH1s C4SjkwYh0hYtbwgC3a49g== X-UI-Out-Filterresults: notjunk:1; Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 5 Feb 2015 13:20:42 +0100 The srp_destroy_fr_pool() 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/ulp/srp/ib_srp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 0747c05..6f5dfa1 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -549,8 +549,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) "FR pool allocation failed (%d)\n", ret); goto err_qp; } - if (ch->fr_pool) - srp_destroy_fr_pool(ch->fr_pool); + srp_destroy_fr_pool(ch->fr_pool); ch->fr_pool = fr_pool; } else if (!dev->use_fast_reg && dev->has_fmr) { fmr_pool = srp_alloc_fmr_pool(target); @@ -615,13 +614,12 @@ static void srp_free_ch_ib(struct srp_target_port *target, if (!ch->qp) return; - if (dev->use_fast_reg) { - if (ch->fr_pool) - srp_destroy_fr_pool(ch->fr_pool); - } else { + if (dev->use_fast_reg) + srp_destroy_fr_pool(ch->fr_pool); + else if (ch->fmr_pool) ib_destroy_fmr_pool(ch->fmr_pool); - } + srp_destroy_qp(ch); ib_destroy_cq(ch->send_cq); ib_destroy_cq(ch->recv_cq);