linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] dma/shdma: move dereference below the NULL check
@ 2010-08-14  9:01 Dan Carpenter
  2010-08-16  8:46 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-08-14  9:01 UTC (permalink / raw)
  To: Dan Williams
  Cc: Paul Mundt, Guennadi Liakhovetski, Magnus Damm, Linus Walleij,
	linux-kernel, kernel-janitors

"param" can be NULL here, so only dereference it after the check.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index fb64cf3..eb6b54d 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -580,7 +580,6 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 
 	sh_chan = to_sh_chan(chan);
 	param = chan->private;
-	slave_addr = param->config->addr;
 
 	/* Someone calling slave DMA on a public channel? */
 	if (!param || !sg_len) {
@@ -589,6 +588,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 		return NULL;
 	}
 
+	slave_addr = param->config->addr;
+
 	/*
 	 * if (param != NULL), this is a successfully requested slave channel,
 	 * therefore param->config != NULL too.

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

* Re: [patch] dma/shdma: move dereference below the NULL check
  2010-08-14  9:01 [patch] dma/shdma: move dereference below the NULL check Dan Carpenter
@ 2010-08-16  8:46 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2010-08-16  8:46 UTC (permalink / raw)
  To: Dan Carpenter, Dan Williams, Paul Mundt, Guennadi Liakhovetski,
	Magnus Damm, Linus Walleij, linux-kernel, kernel-janitors

On Sat, Aug 14, 2010 at 2:01 AM, Dan Carpenter <error27@gmail.com> wrote:
> "param" can be NULL here, so only dereference it after the check.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Thanks, applied as obviously correct.

--
Dan

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

end of thread, other threads:[~2010-08-16  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14  9:01 [patch] dma/shdma: move dereference below the NULL check Dan Carpenter
2010-08-16  8:46 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).