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


Groups > linux.kernel > #1598284

[PATCH] block: DAC960: fix ifnullfree.cocci warnings

From kbuild test robot <lkp@intel.com>
Newsgroups linux.kernel
Subject [PATCH] block: DAC960: fix ifnullfree.cocci warnings
Date 2017-03-11 08:20 +0100
Message-ID <tjJtM-7Li-9@gated-at.bofh.it> (permalink)
References <tjJtM-7Li-7@gated-at.bofh.it> <tiMDp-Dj-61@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


drivers/block/DAC960.c:441:3-19: 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/block/DAC960.c:446:1-17: 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

CC: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -437,13 +437,11 @@ static void DAC960_DestroyAuxiliaryStruc
       Controller->CurrentStatusBuffer = NULL;
     }
 
-  if (ScatterGatherPool != NULL)
-  	dma_pool_destroy(ScatterGatherPool);
+  dma_pool_destroy(ScatterGatherPool);
   if (Controller->FirmwareType == DAC960_V1_Controller)
   	return;
 
-  if (RequestSensePool != NULL)
-	dma_pool_destroy(RequestSensePool);
+  dma_pool_destroy(RequestSensePool);
 
   for (i = 0; i < DAC960_MaxLogicalDrives; i++) {
 	kfree(Controller->V2.LogicalDeviceInformation[i]);

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v5 01/19] block: DAC960: Replace PCI pool old API Romain Perier <romain.perier@collabora.com> - 2017-03-08 17:30 +0100
  Re: [PATCH v5 01/19] block: DAC960: Replace PCI pool old API kbuild test robot <lkp@intel.com> - 2017-03-11 08:20 +0100
  [PATCH] block: DAC960: fix ifnullfree.cocci warnings kbuild test robot <lkp@intel.com> - 2017-03-11 08:20 +0100

csiph-web