From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752661AbaIEP3d (ORCPT ); Fri, 5 Sep 2014 11:29:33 -0400 Received: from smtp-out-239.synserver.de ([212.40.185.239]:1041 "EHLO smtp-out-239.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbaIEP3b (ORCPT ); Fri, 5 Sep 2014 11:29:31 -0400 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 1095 Message-ID: <5409D6D8.2020802@metafoo.de> Date: Fri, 05 Sep 2014 17:29:28 +0200 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0 MIME-Version: 1.0 To: Krzysztof Kozlowski , Dan Williams , Vinod Koul , Michal Simek , Dan Carpenter , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org CC: Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH 1/3] dmaengine: pl330: Do not dereference pl330_thread pointer before non-NULL check References: <1409929466-29506-1-git-send-email-k.kozlowski@samsung.com> In-Reply-To: <1409929466-29506-1-git-send-email-k.kozlowski@samsung.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/05/2014 05:04 PM, Krzysztof Kozlowski wrote: > 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) I think we can just drop that whole line of checks, none of them will ever be true. > > 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 >