From patchwork Mon Sep 29 12:42:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4995891 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A231BEEA6 for ; Mon, 29 Sep 2014 12:42:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D9F120254 for ; Mon, 29 Sep 2014 12:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E0AE20173 for ; Mon, 29 Sep 2014 12:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbaI2Mme (ORCPT ); Mon, 29 Sep 2014 08:42:34 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:64928 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752538AbaI2Mmd (ORCPT ); Mon, 29 Sep 2014 08:42:33 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCN00ND3Y3L0T60@mailout3.w1.samsung.com>; Mon, 29 Sep 2014 13:45:21 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-53-542953b5d758 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id E9.A8.15956.5B359245; Mon, 29 Sep 2014 13:42:29 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NCN00BL6XYPL940@eusync2.samsung.com>; Mon, 29 Sep 2014 13:42:29 +0100 (BST) From: Krzysztof Kozlowski To: Vinod Koul , Dan Williams , Lars-Peter Clausen , Michal Simek , Dan Carpenter , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski Subject: [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Date: Mon, 29 Sep 2014 14:42:18 +0200 Message-id: <1411994541-31494-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t/xK7pbgzVDDB6tMLLYOGM9q8Xrf9NZ LKZPvcBosXrqXyD3haHF2aY37BZLJs9ntbi8aw6bxdojd9kt3r2MsHjZt5/Fgdtj8Z6XTB5L 3hxi9fj49BaLR9+WVYwenzfJeez9/JslgC2KyyYlNSezLLVI3y6BK2Pz42dsBVe4KuaePc7Y wPiUo4uRk0NCwETi1em3rBC2mMSFe+vZuhi5OIQEljJKvHt4gRHC6WOS6Lj6khmkik3AWGLz 8iVgVSICrUwSL2Z+YgFxmAWOMkpM733L1MXIwSEskCHx6FAEiMkioCqxbAIvSC+vgLvEvKmn 2CC2yUmcPDaZdQIj9wJGhlWMoqmlyQXFSem5RnrFibnFpXnpesn5uZsYIUH1dQfj0mNWhxgF OBiVeHg5VmiECLEmlhVX5h5ilOBgVhLhtbPVDBHiTUmsrEotyo8vKs1JLT7EyMTBKdXAGFTw pC216pJNjiW/1J/tbDLiX2I1L3fG1BY02in3LBA89ztpUb6O73mPf7LB4eG3M/4YvDOOcdm5 J4u1YeYKVcZk95mfbXIcdS/0NVo5rFt7YmMn28ZfYhkSE0pfeHMf7twUZ7pDvWzatY0NrD4h GbHliVd73s1U2fj+91dujWN7u6ZVPnmkxFKckWioxVxUnAgA4J0+RwgCAAA= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The pl330_submit_req() checked supplied 'struct pl330_thread thrd' and 'struct dma_pl330_desc desc' parameters for non-NULL. However these checks are useless because supplied arguments won't be NULL. The pl330_submit_req() is called in only one place and: 1. 'desc' is already dereferenced in fill_queue() before calling pl330_submit_req(). 2. 'thrd' is always dereferenced after calling fill_queue()->pl330_submit_req(). Removing the checks for non-NULL values fixes following warning: drivers/dma/pl330.c:1376 pl330_submit_req() warn: variable dereferenced before check 'thrd' (see line 1367) Signed-off-by: Krzysztof Kozlowski --- Changes since v1: ================= 1. Remove the checks for non-NULL completely instead of moving them before dereference. Suggested by Lars-Peter Clausen. --- drivers/dma/pl330.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index d5149aacd2fe..57049f84d0c0 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1372,10 +1372,6 @@ static int pl330_submit_req(struct pl330_thread *thrd, u32 ccr; int ret = 0; - /* No Req or Unacquired Channel or DMAC */ - if (!desc || !thrd || thrd->free) - return -EINVAL; - regs = thrd->dmac->base; if (pl330->state == DYING