Skip to contentSkip to conversation

dma/shdma: move dereference below the NULL check

PATCH Applied Dan Carpenter 2 participants 2 messages Aug 14, 2010 – Aug 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma/shdma: move dereference below the NULL check

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

drivers/dma/shdma.c +2 -1
index fb64cf3..eb6b54d 100644
@@ -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.