From patchwork Mon Dec 1 05:12:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5410051 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 011119F1CD for ; Mon, 1 Dec 2014 05:12:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 389D3202EB for ; Mon, 1 Dec 2014 05:12:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C691202E6 for ; Mon, 1 Dec 2014 05:12:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751157AbaLAFM3 (ORCPT ); Mon, 1 Dec 2014 00:12:29 -0500 Received: from mout.web.de ([212.227.17.12]:64736 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbaLAFM3 (ORCPT ); Mon, 1 Dec 2014 00:12:29 -0500 Received: from [192.168.1.2] ([78.48.162.200]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MWS3S-1XNdSn2xuE-00Xd9D; Mon, 01 Dec 2014 06:12:23 +0100 Message-ID: <547BF8B5.309@users.sourceforge.net> Date: Mon, 01 Dec 2014 06:12:21 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/1] DMA: Delete a check before free_percpu() 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:jsrl7snAqSR+f0q0wROjCtMH4cLeFJPOyymOPvsUY7iKbYF+e+r 32ahMDqQMoRC2elHmw3KrVfwFxL7cTNw7R/a6PtrUJQ4SpPd1DoSLB6bhyh8/GfndwV6vOZ YXz+n/PcV3wuCaQvAwYfh9uk0XNvwVn+OP+vSTbKk8PKo1hmVAelJtCxPFxlih4xzKz8jg2 6Fxn7iAqoXqxHcfyVLXKg== X-UI-Out-Filterresults: notjunk:1; Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@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: Mon, 1 Dec 2014 06:06:57 +0100 The free_percpu() 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/dma/dmaengine.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 24bfaf0..e057935 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -330,8 +330,7 @@ static int __init dma_channel_table_init(void) if (err) { pr_err("initialization failure\n"); for_each_dma_cap_mask(cap, dma_cap_mask_all) - if (channel_table[cap]) - free_percpu(channel_table[cap]); + free_percpu(channel_table[cap]); } return err;