[PATCH] staging: kpc2000: fix badzero.cocci warnings

kbuild test robot lkp at intel.com
Fri May 17 22:18:23 UTC 2019


From: kbuild test robot <lkp at intel.com>

drivers/staging/kpc2000/kpc2000_i2c.c:682:16-17: WARNING comparing pointer to 0

 Compare pointer-typed values to NULL rather than 0

Semantic patch information:
 This makes an effort to choose between !x and x == NULL.  !x is used
 if it has previously been used with the function used to initialize x.
 This relies on type information.  More type information can be obtained
 using the option -all_includes and the option -I to specify an
 include path.

Generated by: scripts/coccinelle/null/badzero.cocci

Fixes: 98733648ef27 ("staging: kpc2000: move the i2c driver out of its subdirectory")
CC: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: kbuild test robot <lkp at intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Greg-Kroah-Hartman/staging-kpc2000-fix-a-bunch-of-orginization-and-header-file-issues/20190517-213909

 kpc2000_i2c.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -679,7 +679,7 @@ int pi2c_remove(struct platform_device *
     //pci_set_drvdata(dev, NULL);
     
     //cdev_del(&lddev->cdev);
-    if(lddev != 0) {
+    if(lddev != NULL) {
         kfree(lddev);
         pldev->dev.platform_data = 0;
     }


More information about the devel mailing list