Hello there,

I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33-rc8

It said

Checking ./drivers/mmc/card/queue.c...
[./drivers/mmc/card/queue.c:212]: (style) Redundant condition. It is safe to 
deallocate a NULL pointer
[./drivers/mmc/card/queue.c:215]: (style) Redundant condition. It is safe to 
deallocate a NULL pointer
[./drivers/mmc/card/queue.c:208]: (style) Redundant condition. It is safe to 
deallocate a NULL pointer
[./drivers/mmc/card/queue.c:239]: (style) Redundant condition. It is safe to 
deallocate a NULL pointer
[./drivers/mmc/card/queue.c:246]: (style) Redundant condition. It is safe to 
deallocate a NULL pointer

I checked the source code and I agree with cppcheck. 
Patch file attached.

Regards

David Binderman

                                          
_________________________________________________________________
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
--- drivers/mmc/card/queue.c.sav	2010-02-21 09:08:45.000000000 +0000
+++ drivers/mmc/card/queue.c	2010-02-21 09:09:51.000000000 +0000
@@ -205,15 +205,12 @@ int mmc_init_queue(struct mmc_queue *mq,
 
 	return 0;
  free_bounce_sg:
- 	if (mq->bounce_sg)
- 		kfree(mq->bounce_sg);
+	kfree(mq->bounce_sg);
  	mq->bounce_sg = NULL;
  cleanup_queue:
- 	if (mq->sg)
-		kfree(mq->sg);
+	kfree(mq->sg);
 	mq->sg = NULL;
-	if (mq->bounce_buf)
-		kfree(mq->bounce_buf);
+	kfree(mq->bounce_buf);
 	mq->bounce_buf = NULL;
 	blk_cleanup_queue(mq->queue);
 	return ret;
@@ -236,15 +233,13 @@ void mmc_cleanup_queue(struct mmc_queue
 	blk_start_queue(q);
 	spin_unlock_irqrestore(q->queue_lock, flags);
 
- 	if (mq->bounce_sg)
- 		kfree(mq->bounce_sg);
+	kfree(mq->bounce_sg);
  	mq->bounce_sg = NULL;
 
 	kfree(mq->sg);
 	mq->sg = NULL;
 
-	if (mq->bounce_buf)
-		kfree(mq->bounce_buf);
+	kfree(mq->bounce_buf);
 	mq->bounce_buf = NULL;
 
 	mq->card = NULL;

Reply via email to