From patchwork Tue Nov 17 08:44:27 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: 7634001 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 99B2B9F1D3 for ; Tue, 17 Nov 2015 08:44:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7DB820462 for ; Tue, 17 Nov 2015 08:44:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D98D720421 for ; Tue, 17 Nov 2015 08:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752785AbbKQIol (ORCPT ); Tue, 17 Nov 2015 03:44:41 -0500 Received: from mout.web.de ([212.227.17.11]:57030 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbbKQIok (ORCPT ); Tue, 17 Nov 2015 03:44:40 -0500 Received: from [192.168.1.3] ([77.182.159.196]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MCZtW-1a6pKx2EKY-009MkJ; Tue, 17 Nov 2015 09:44:29 +0100 Subject: [PATCH] SCSI-lpfc: Delete unnecessary checks before the function call "mempool_destroy" 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> To: Dick Kennedy , "James E. J. Bottomley" , James Smart , linux-scsi@vger.kernel.org Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564AE8EB.4050509@users.sourceforge.net> Date: Tue, 17 Nov 2015 09:44:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:jYYT/3K5ZTRa0pA6ESZkduiQQ6Hd+b/E7LPOURnLmBm6tKIZnkG KmyMWXURrwhSNm/I1NUthugp2WGgiXWr7tsAbifHpyEw3+ETjmIMygz0BhfO+NYjwC/NeLc Uhdf7aqIy4QLcLXalOmU4hUWPD+x1tBsEzIHoX5Il9jPvyPjsb6pz01kEOQmJuEz2rDFzOq emq+cIn37ccQDZ+cLWUrQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:NgMzb+SkFlk=:98NDuxIBOCXJG6DwlFHIqA TkH6XAeyP+kzDfC5gSn/uDxNch9tEnh8bdVDyQklxi12B00dpOlC3s4+CNjLIfSe4B38F3qxt LZ6JVXehDS9YdtxG+8v41pVCSrS0Xw+0qWeIwk+/0hYEiHDWpxPqPP/9OjfH4zIfsqdWI4J+W w2dsjNpOSSV39qhtvHur9hBeHg+5vbVrt8ucBO568h6LYMENSXB/vtKapw1iwap1qE7JAf5OO VhWTeRvs87c+B2K89Z/xBcOX4VFGGDBVKpMYLkXU/pU2ScaLCvQcvOduT4Qk1hhv61Xp6lNRS A+iCmY2kd9hZQgzEew5/iTn4tfMjT0KRqfr7HceUxzcYcXq7XOSyQe9gK3mEthFCOwUm3nTD+ 8OXl+UrSV7AnnwG4rgATggyoKybYlc4M4qBHozGXBauHx0zh/KfzK7lciLK6pgri4KAf5dDmX 6io/3DAoTyvY9u12U8HBt/CQJe7XHjwIMPqKCAAYbTIII0nB6SDu6GntqHHF3j+BKE1mWPT7w AEK+ZFUY36HYBF0RXVc6sLyAgIXHBLAOdcumIzUWzbG0jy7/Xw19MROrr8WcAp7W4kqY4TbmY OGkcZxYfhLXNIjAaUxnd/9Ud4zqFcjmGfA98iTuOQ62EmuQuucIf3MQqbT3vgSpM9/d5hBQ+5 Wpm/5sM77uOX1IxSgSUxLEHOSaaSFst1rfdhTHed0DrhHlilqboqGGluN0M0VFIyy8fFsuv7h bYljpsJWJ+O9BhBMTD3/9uJ2FzVgt7UY9ZPktOVLC0rhQcGbjVpaYSEen+1Wh3Y8FTD1kd7Xk l8rUkWa Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Tue, 17 Nov 2015 09:34:27 +0100 The mempool_destroy() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/lpfc/lpfc_mem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3fa6533..4fb3581 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c @@ -231,15 +231,13 @@ lpfc_mem_free(struct lpfc_hba *phba) if (phba->lpfc_hbq_pool) pci_pool_destroy(phba->lpfc_hbq_pool); phba->lpfc_hbq_pool = NULL; - - if (phba->rrq_pool) - mempool_destroy(phba->rrq_pool); + mempool_destroy(phba->rrq_pool); phba->rrq_pool = NULL; /* Free NLP memory pool */ mempool_destroy(phba->nlp_mem_pool); phba->nlp_mem_pool = NULL; - if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) { + if (phba->sli_rev == LPFC_SLI_REV4) { mempool_destroy(phba->active_rrq_pool); phba->active_rrq_pool = NULL; }