From patchwork Mon Jun 29 10:48:16 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: 6688361 Return-Path: X-Original-To: patchwork-linux-arm@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 CB6C9C05AC for ; Mon, 29 Jun 2015 10:51:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF7062045E for ; Mon, 29 Jun 2015 10:51:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDAF320211 for ; Mon, 29 Jun 2015 10:51:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z9Wcg-0005YM-Vb; Mon, 29 Jun 2015 10:49:10 +0000 Received: from mout.web.de ([212.227.15.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z9WcY-0005NA-5M for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2015 10:49:03 +0000 Received: from [192.168.1.2] ([77.182.51.120]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0M2dt7-1YsxlW3yar-00sLGZ; Mon, 29 Jun 2015 12:48:28 +0200 Message-ID: <55912270.4030201@users.sourceforge.net> Date: Mon, 29 Jun 2015 12:48:16 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Derek Chickles , Felix Manlunas , Raghu Vatsavayi , Robert Richter , Satanand Burla , Sunil Goutham , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] net-Liquidio: Delete unnecessary checks before the function call "vfree" 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:256oO4QCxPR/ixDu3+2i+OSDarSOPAjuvBBuGxZNdu9SIpmzesy maYFOSx0uvfdrFxp4Ol9PIkuBNRNv4fh0z8DeUoRly6qoqWbcdwIuK9qXINVCDaFmJpCU4Y H6S+tCjJ/ip1TU1YyUakOEufBIhhGNtk4YQl53Qq5MD2W2xgRTx0trL1p5WHfNen/vz7zfA BSCbGPPQmv6+iovDaHsIA== X-UI-Out-Filterresults: notjunk:1; V01:K0:4hrwEivmxjc=:CVaWI3bx6czH2zGBgfcU0j WNIcK1deSlJ8dGowVNE84oCiWpLSjKggFE8zcYl40sRS8moSt1zdeMJkmuR/fYQc7jyH2oOcN A0RXD1DkVY4h2WUkCVezQ5vfyhNGHy8f32IpBFqRo9++f9/tm1FS7Pr7I0yKwwrNSEqtwaSWz r7PQtR6OYyiE0GMOp2zFkBkj90mG3qzqbJ0NLKfpO32ji53rOhXd+j0b2sEjCtKKSOdMovZEs WzXLB4oMD1qI+H1J1+BtvZttphxPBJwpEScIwBcC1XUKOBUgO7W5Di6N55y9XoWTQk2BFfnku HJfjyphOWe1Ndmp0/6bZquYecVG7ekLdqQO3o1sT4hAnmBYdZd9PWOg4xIAkfzoN5UiE6SoY6 0DEJk1ZFgXGi4zV/Fbl90dYZ+W0jmL15iQBr0H+ETkGeH3voWtXkezOwgz3dsij8l+i+nIq44 cCQCPgNpRBrGacrnkBcYtWyy3cmSSbzmx3qkP6eTIMLnQG4riPMiBMQs1l1S3wFvc0JzHnwZR 5T/q46XotqLKwlOoMbDMS5jJyeh+59j56gorAJnbvq4Yvko0eIXbW+KJTETIuELYHGv3MTlkP 1oBGd6Pe0RXZi/sR/HesnYL6BcZMrh2Uw8EMcHW1r5gQUleeqs8TfQSAHG3znwV4ZmmcW+s4c qRxIZDEY4Vt4u6UWzWH5ETp2yi0/qD8j51GWuMFIjJlXu5aAHSX6kbUgc+h6zaBiBXso= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150629_034902_635331_8E587E42 X-CRM114-Status: GOOD ( 12.83 ) X-Spam-Score: -1.9 (-) Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: Mon, 29 Jun 2015 12:22:24 +0200 The vfree() function performs also input parameter validation. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/ethernet/cavium/liquidio/octeon_device.c | 11 +++-------- drivers/net/ethernet/cavium/liquidio/octeon_droq.c | 4 +--- drivers/net/ethernet/cavium/liquidio/request_manager.c | 3 +-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c index 0d3106b..f67641a 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c @@ -650,14 +650,12 @@ void octeon_free_device_mem(struct octeon_device *oct) for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES; i++) { /* could check mask as well */ - if (oct->droq[i]) - vfree(oct->droq[i]); + vfree(oct->droq[i]); } for (i = 0; i < MAX_OCTEON_INSTR_QUEUES; i++) { /* could check mask as well */ - if (oct->instr_queue[i]) - vfree(oct->instr_queue[i]); + vfree(oct->instr_queue[i]); } i = oct->octeon_id; @@ -1078,10 +1076,7 @@ octeon_unregister_dispatch_fn(struct octeon_device *oct, u16 opcode, oct->dispatch.count--; spin_unlock_bh(&oct->dispatch.lock); - - if (dfree) - vfree(dfree); - + vfree(dfree); return retval; } diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c index 94b502a..4dba86e 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c +++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c @@ -216,9 +216,7 @@ int octeon_delete_droq(struct octeon_device *oct, u32 q_no) dev_dbg(&oct->pci_dev->dev, "%s[%d]\n", __func__, q_no); octeon_droq_destroy_ring_buffers(oct, droq); - - if (droq->recv_buf_list) - vfree(droq->recv_buf_list); + vfree(droq->recv_buf_list); if (droq->info_base_addr) cnnic_free_aligned_dma(oct->pci_dev, droq->info_list, diff --git a/drivers/net/ethernet/cavium/liquidio/request_manager.c b/drivers/net/ethernet/cavium/liquidio/request_manager.c index 356796b..a2a2465 100644 --- a/drivers/net/ethernet/cavium/liquidio/request_manager.c +++ b/drivers/net/ethernet/cavium/liquidio/request_manager.c @@ -175,8 +175,7 @@ int octeon_delete_instr_queue(struct octeon_device *oct, u32 iq_no) desc_size = CFG_GET_IQ_INSTR_TYPE(CHIP_FIELD(oct, cn6xxx, conf)); - if (iq->request_list) - vfree(iq->request_list); + vfree(iq->request_list); if (iq->base_addr) { q_size = iq->max_count * desc_size;