mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters
@ 2014-09-08  8:42 Krzysztof Kozlowski
  2014-09-08  8:42 ` [PATCH v2 2/4] dmaengine: pl330: Remove unused 'regs' variable in pl330_submit_req() Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-09-08  8:42 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, dmaengine, linux-kernel
  Cc: Lars-Peter Clausen, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski

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

---

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
-- 
1.9.1


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08  8:42 [PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Krzysztof Kozlowski
2014-09-08  8:42 ` [PATCH v2 2/4] dmaengine: pl330: Remove unused 'regs' variable in pl330_submit_req() Krzysztof Kozlowski
2014-09-08  8:42 ` [PATCH v2 3/4] dmaengine: pl330: Fix NULL pointer dereference on probe failure Krzysztof Kozlowski
2014-09-08  8:42 ` [PATCH v2 4/4] dmaengine: pl330: Fix NULL pointer dereference on driver unbind Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®