Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752980AbbKPSGQ (ORCPT ); Mon, 16 Nov 2015 13:06:16 -0500 Received: from mout.web.de ([212.227.15.3]:65406 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751172AbbKPSGN (ORCPT ); Mon, 16 Nov 2015 13:06:13 -0500 Subject: [PATCH] USB-EHCI: Delete unnecessary checks before the function call "dma_pool_destroy" To: linux-usb@vger.kernel.org, Greg Kroah-Hartman , Alan Stern 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> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564A1B00.8030507@users.sourceforge.net> Date: Mon, 16 Nov 2015 19:05:52 +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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:TqcO5nLHGVDVSYM9merJGHWpxm+0UD938zN1NOqIR4OHwRWpJYs nYrJcJ3u8Ng9iGo9bIBKtWXd2Dy8pnzrer7v+Ozmyy7HHVMmPyIPL2uB7Lm6AExqbYnsEkx gb+/f7mjaYMn6X1ZmLf8ImqZNO4xsA3XubYhgVW5b42JN93Wy+i8VDZ3nZ4gWx3nQHYUBwS okF0TkePpszH+cdo4+e3A== X-UI-Out-Filterresults: notjunk:1;V01:K0:f7475pYHPlY=:/twSQ1JKbyv4/Q6/aFcyJJ BUVZw0tjKYPpwKy7eY4h6bbU7mIwxB9oK1J89RueTEvUEVz72ANkPmAq3rwy3QkTz4tCplzhL itmCTVTwqpYFNZTOfOHJUKZJYLBsclO5sekdro9nuQJKE1PF6m/XiEQRCBLn1vHv/I1btOPdr VfIwYWLApPkBNXYHXrrGs+0/krhTxafwGi0IM4B91oXOxqScN359uTVYggpelPpR1hpbaWvqi f9JkF9wxEQjC/EI9cCRfLd7J6e7L9pwgPGJt/lR/+Ma+FgwA+3mS7WJ34Sz8OW0wXSjHAOgHP Cc+TE/nky2/zqpUNBEtgo8ld1RjwBg7jxf/1rIhSqcUU9DbLqpSGcZTx/lJE8h35Jn6oaiyf6 Qv2cEo/eqwc2fwTlN47L14N5esxnBsA8Uzy1cZ3Vsd2fCY6T4xR7HF1urj2zzEyrxFhnAIlg2 eZEnmtX1kyMzRukn5K1ysumeYhGNBe7jHk2dMiaxCdKub9gf46a56VnenTLUB6f+fBQLlS3CA Bgn2La2g1S9Ywi/1s8CB00gf+xeg9GaXoEfhjPPDeo0xka7CfrQCPHqTwau0VQXLUnmaIO/tg 51zFI7/H+Pzgz5KGGzZvRU6icLAFp33ntxaV9g05pDFoBG7B4fx96JoS6yyAFC2jmEpaHf9+K o2zVitCWfaFCcEca8DJe2yxvQn1r9h+4xWUtlHnxvGvmLcEtfvTKFJr1D8tLTNIiMrM6dL0E+ /m/+yGq4S9GdvhxwRtsCAV+umtpegQC3pgz/j5fDU4jQIIhMLnByZq0XMy6im1mgnCFS9VDaT KocnJGQ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1574 Lines: 52 From: Markus Elfring Date: Mon, 16 Nov 2015 19:01:44 +0100 The dma_pool_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/usb/host/ehci-mem.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index b6205fa..4de4301 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c @@ -128,21 +128,13 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) ehci->dummy = NULL; /* DMA consistent memory and pools */ - if (ehci->qtd_pool) - dma_pool_destroy (ehci->qtd_pool); + dma_pool_destroy(ehci->qtd_pool); ehci->qtd_pool = NULL; - - if (ehci->qh_pool) { - dma_pool_destroy (ehci->qh_pool); - ehci->qh_pool = NULL; - } - - if (ehci->itd_pool) - dma_pool_destroy (ehci->itd_pool); + dma_pool_destroy(ehci->qh_pool); + ehci->qh_pool = NULL; + dma_pool_destroy(ehci->itd_pool); ehci->itd_pool = NULL; - - if (ehci->sitd_pool) - dma_pool_destroy (ehci->sitd_pool); + dma_pool_destroy(ehci->sitd_pool); ehci->sitd_pool = NULL; if (ehci->periodic) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/