crypto: qat - cleanup coccicheck warning - NULL check before freeing functions
authorBruce Allan <bruce.w.allan@intel.com>
Wed, 15 Oct 2014 18:33:21 +0000 (11:33 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Oct 2014 14:49:38 +0000 (22:49 +0800)
Analyzing with coccinelle MODE=report...

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

drivers/crypto/qat/qat_dh895xcc/adf_isr.c:191:3-8: 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/crypto/qat/qat_dh895xcc/adf_isr.c:208:3-8: 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.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_dh895xcc/adf_isr.c

index 67ec61e51185b3e402da164d0c15b4b464d53ec6..c9212b919b2cc12ae882e50a726720971d8c39bc 100644 (file)
@@ -186,10 +186,8 @@ static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev)
        accel_dev->accel_pci_dev.msix_entries.names = names;
        return 0;
 err:
-       for (i = 0; i < msix_num_entries; i++) {
-               if (*(names + i))
-                       kfree(*(names + i));
-       }
+       for (i = 0; i < msix_num_entries; i++)
+               kfree(*(names + i));
        kfree(entries);
        kfree(names);
        return -ENOMEM;
@@ -203,10 +201,8 @@ static void adf_isr_free_msix_entry_table(struct adf_accel_dev *accel_dev)
        int i;
 
        kfree(accel_dev->accel_pci_dev.msix_entries.entries);
-       for (i = 0; i < msix_num_entries; i++) {
-               if (*(names + i))
-                       kfree(*(names + i));
-       }
+       for (i = 0; i < msix_num_entries; i++)
+               kfree(*(names + i));
        kfree(names);
 }