All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dmaengine: pl330: Do not dereference pl330_thread pointer before non-NULL check
@ 2014-09-05 15:04 Krzysztof Kozlowski
  2014-09-05 15:04 ` [PATCH 2/3] dmaengine: pl330: Fix NULL pointer dereference on probe failure Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2014-09-05 15:04 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, Lars-Peter Clausen, Michal Simek,
	Dan Carpenter, dmaengine, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

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 <k.kozlowski@samsung.com>
---
 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
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-08  7:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 15:04 [PATCH 1/3] dmaengine: pl330: Do not dereference pl330_thread pointer before non-NULL check Krzysztof Kozlowski
2014-09-05 15:04 ` [PATCH 2/3] dmaengine: pl330: Fix NULL pointer dereference on probe failure Krzysztof Kozlowski
2014-09-05 15:31   ` Lars-Peter Clausen
2014-09-05 15:04 ` [PATCH 3/3] dmaengine: pl330: Fix NULL pointer dereference on driver unbind Krzysztof Kozlowski
2014-09-05 15:30   ` Lars-Peter Clausen
2014-09-05 15:29 ` [PATCH 1/3] dmaengine: pl330: Do not dereference pl330_thread pointer before non-NULL check Lars-Peter Clausen
2014-09-08  7:56   ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.