Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695882 > unrolled thread

[PATCH] scsi: megaraid: fix ifnullfree.cocci warnings

Started bykbuild test robot <fengguang.wu@intel.com>
First post2017-07-25 17:50 +0200
Last post2017-07-25 18:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] scsi: megaraid: fix ifnullfree.cocci warnings kbuild test robot <fengguang.wu@intel.com> - 2017-07-25 17:50 +0200
    Re: [PATCH] scsi: megaraid: fix ifnullfree.cocci warnings James Bottomley <jejb@linux.vnet.ibm.com> - 2017-07-25 18:00 +0200

#1695882 — [PATCH] scsi: megaraid: fix ifnullfree.cocci warnings

Fromkbuild test robot <fengguang.wu@intel.com>
Date2017-07-25 17:50 +0200
Subject[PATCH] scsi: megaraid: fix ifnullfree.cocci warnings
Message-ID<u7afV-4DI-47@gated-at.bofh.it>
drivers/scsi/megaraid/megaraid_sas_fusion.c:608:2-18: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
drivers/scsi/megaraid/megaraid_sas_fusion.c:629:2-18: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: cbb80044a6c7 ("scsi: megaraid: Replace PCI pool old API")
CC: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 megaraid_sas_fusion.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -604,8 +604,7 @@ megasas_free_rdpq_fusion(struct megasas_
 				fusion->reply_frames_desc_phys[i]);
 	}
 
-	if (fusion->reply_frames_desc_pool)
-		dma_pool_destroy(fusion->reply_frames_desc_pool);
+	dma_pool_destroy(fusion->reply_frames_desc_pool);
 
 	if (fusion->rdpq_virt)
 		pci_free_consistent(instance->pdev,
@@ -625,8 +624,7 @@ megasas_free_reply_fusion(struct megasas
 			fusion->reply_frames_desc[0],
 			fusion->reply_frames_desc_phys[0]);
 
-	if (fusion->reply_frames_desc_pool)
-		dma_pool_destroy(fusion->reply_frames_desc_pool);
+	dma_pool_destroy(fusion->reply_frames_desc_pool);
 
 }
 

[toc] | [next] | [standalone]


#1695892

FromJames Bottomley <jejb@linux.vnet.ibm.com>
Date2017-07-25 18:00 +0200
Message-ID<u7apz-4Hw-11@gated-at.bofh.it>
In reply to#1695882
On Tue, 2017-07-25 at 23:40 +0800, kbuild test robot wrote:
> drivers/scsi/megaraid/megaraid_sas_fusion.c:608:2-18: WARNING: NULL
> check before freeing functions like kfree, debugfs_remove,
> debugfs_remove_recursive or usb_free_urb is not needed. Maybe
> consider reorganizing relevant code to avoid passing NULL values.
> drivers/scsi/megaraid/megaraid_sas_fusion.c:629:2-18: WARNING: NULL
> check before freeing functions like kfree, debugfs_remove,
> debugfs_remove_recursive or usb_free_urb is not needed. Maybe
> consider reorganizing relevant code to avoid passing NULL values.
> 
>  NULL check before some freeing functions is not needed.

Hey, guys, we yelled at Markus Elfring for sending hundreds of patches
like this.  The reason then was too much code churn for too little
value: the if() might be unnecessary but it really doesn't cost very
much in terms of execution time, so the code churn disadvantage greatly
 outweighs any benefits.

The reason hasn't changed, so please stop this otherwise you're going
to turn the very valuable 0day test infrastructure into a thousand
patch spambot.

James

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web