Skip to contentSkip to conversation

dma: imx-dma: Remove redundant NULL check before kfree

PATCH In review Syam Sidhardhan 2 participants 2 messages Feb 24, 2013 – Mar 21, 2013

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

PATCH 1/1 dma: imx-dma: Remove redundant NULL check before kfree

kfree on NULL pointer is a no-op.

---
 drivers/dma/imx-dma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/imx-dma.c +1 -2
index 70b8975..0988583 100644
@@ -859,8 +859,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
 
 	desc = list_first_entry(&imxdmac->ld_free, struct imxdma_desc, node);
 
-	if (imxdmac->sg_list)
-		kfree(imxdmac->sg_list);
+	kfree(imxdmac->sg_list);
 
 	imxdmac->sg_list = kcalloc(periods + 1,
 			sizeof(struct scatterlist), GFP_KERNEL);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Syam Sidhardhan

kfree on NULL pointer is a no-op.

Applied thanks

Quoted 21 lines
---
 drivers/dma/imx-dma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/imx-dma.c +1 -2
index 70b8975..0988583 100644
@@ -859,8 +859,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
 
 	desc = list_first_entry(&imxdmac->ld_free, struct imxdma_desc, node);
 
-	if (imxdmac->sg_list)
-		kfree(imxdmac->sg_list);
+	kfree(imxdmac->sg_list);
 
 	imxdmac->sg_list = kcalloc(periods + 1,
 			sizeof(struct scatterlist), GFP_KERNEL);
Signature · 1 line
1.7.9.5