From patchwork Fri Sep 5 15:04:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4852691 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 9AE52C0338 for ; Fri, 5 Sep 2014 15:04:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 587B22021A for ; Fri, 5 Sep 2014 15:04:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A63320211 for ; Fri, 5 Sep 2014 15:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbaIEPEk (ORCPT ); Fri, 5 Sep 2014 11:04:40 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:31793 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbaIEPEj (ORCPT ); Fri, 5 Sep 2014 11:04:39 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBF001KEOOK3XB0@mailout1.w1.samsung.com>; Fri, 05 Sep 2014 16:07:32 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-1e-5409d105b998 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 49.3D.15956.501D9045; Fri, 05 Sep 2014 16:04:37 +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 <0NBF00FSEOJL2G20@eusync1.samsung.com>; Fri, 05 Sep 2014 16:04:37 +0100 (BST) From: Krzysztof Kozlowski To: Dan Williams , Vinod Koul , 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: [PATCH 1/3] dmaengine: pl330: Do not dereference pl330_thread pointer before non-NULL check Date: Fri, 05 Sep 2014 17:04:24 +0200 Message-id: <1409929466-29506-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsVy+t/xy7qsFzlDDPb/5bbYOGM9q8Xrf9NZ LKZPvcBosXrqXyD3haHF2aY37BZLJs9ntbi8aw6bxdojd9kt3r2MsHjZt5/Fgdtj8Z6XTB5L 3hxi9fj49BaLR9+WVYwenzfJeez9/JslgC2KyyYlNSezLLVI3y6BK2P/gTVsBYc4Ktb3z2Rt YGxl72Lk5JAQMJF48vM0M4QtJnHh3nq2LkYuDiGBpYwSn5sXskA4fUwSjbtXMIJUsQkYS2xe vgSsSkSglUni4rrpYFXMAkcZJab3vmUCqRIWSJM40fAXbC6LgKrEq3PbwfbxCrhL3H/5CGqf nMTJY5NZJzByL2BkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kRElhfdzAuPWZ1iFGAg1GJ h7dDkzNEiDWxrLgy9xCjBAezkgiv7W6gEG9KYmVValF+fFFpTmrxIUYmDk6pBsZZFr/rGQ4Z razb2VW8XGxq+za5x/sDBWexnNv19Ju6wbfFHzxd9GL9qxs61yre8Li0LCXTb4uvhFQJy6Hu DUpuveXdQTumvpwqXLT2KtfSxG7xvaF/tP6sZZoiuZPRfeGGOrdFoeeNGVkCL9yW/v8yOZKh /KacvIBI5jye/1rC107OY9F4nKPEUpyRaKjFXFScCABv412VCgIAAA== Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-8.6 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 Do not dereference the 'struct pl330_thread *thrd' before the check for non-NULL value. This 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 --- drivers/dma/pl330.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index d5149aacd2fe..47d82070848d 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1364,7 +1364,7 @@ static inline u32 _prepare_ccr(const struct pl330_reqcfg *rqc) static int pl330_submit_req(struct pl330_thread *thrd, struct dma_pl330_desc *desc) { - struct pl330_dmac *pl330 = thrd->dmac; + struct pl330_dmac *pl330; struct _xfer_spec xs; unsigned long flags; void __iomem *regs; @@ -1376,6 +1376,7 @@ static int pl330_submit_req(struct pl330_thread *thrd, if (!desc || !thrd || thrd->free) return -EINVAL; + pl330 = thrd->dmac; regs = thrd->dmac->base; if (pl330->state == DYING