From patchwork Mon Sep 8 08:42:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4860581 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 8482C9F32E for ; Mon, 8 Sep 2014 08:44:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 529432011D for ; Mon, 8 Sep 2014 08:44:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B3EF200F4 for ; Mon, 8 Sep 2014 08:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753432AbaIHInT (ORCPT ); Mon, 8 Sep 2014 04:43:19 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:29000 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbaIHInN (ORCPT ); Mon, 8 Sep 2014 04:43:13 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0NBK00EN2R0P0M50@mailout3.w1.samsung.com>; Mon, 08 Sep 2014 09:46:01 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-37-540d6c1ee436 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 21.A9.25543.E1C6D045; Mon, 08 Sep 2014 09:43:10 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBK00IE5QVVTY90@eusync1.samsung.com>; Mon, 08 Sep 2014 09:43:10 +0100 (BST) From: Krzysztof Kozlowski To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski Subject: [PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Date: Mon, 08 Sep 2014 10:42:47 +0200 Message-id: <1410165770-4452-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t/xy7pyObwhBree6lhsnLGe1WL61AuM Fqun/mW1eP3C0OJs0xt2iyWT57NaXN41h81i7ZG77BYv+/azOHB6LN7zksljyZtDrB59W1Yx enzeJBfAEsVlk5Kak1mWWqRvl8CVsfnxM7aCK1wVc88eZ2xgfMrRxcjBISFgInHpXXoXIyeQ KSZx4d56ti5GLg4hgaWMEn1rlrBAOH1MEoenXWMDqWITMJbYvHwJWJWIQCejxMfJJ1lBHGaB t4wSHw5vZgepEhZIlNjQPpcJxGYRUJXoXbWUBcTmFXCTuL/4OyvEPjmJk8cms05g5F7AyLCK UTS1NLmgOCk911CvODG3uDQvXS85P3cTIyRgvuxgXHzM6hCjAAejEg9vwlWeECHWxLLiytxD jBIczEoivAxhvCFCvCmJlVWpRfnxRaU5qcWHGJk4OKUaGEsZFvd+fsU/6/t23zkO9dGhursK HRPicsqlggXXrn9Zv2u/12UTF701297N1knYET8jhN1T7PYyk4mCsh/PqInbPgyplJx89HfS hJzr2xZcu7s/Q3fhp6jTXzYu3v/UPa+feZr1DL3DNjv2x5gsuduv9PPS8tknDXwunssSmSk2 bR/XTsUjf74rsRRnJBpqMRcVJwIAlIRc0PYBAAA= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-9.4 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