drivers/net: Fix ptr_ret.cocci warnings.
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Tue, 25 Jul 2017 07:00:26 +0000 (00:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 19:27:06 +0000 (12:27 -0700)
we can use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
1. drivers/net/appletalk/ipddp.c
2. drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/appletalk/ipddp.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c

index a306de4318d7d2301fdcb8f34c7045e884278ad4..9375cef2242053c1f1ade3323d04d7dd4bea77af 100644 (file)
@@ -311,9 +311,7 @@ module_param(ipddp_mode, int, 0);
 static int __init ipddp_init_module(void)
 {
        dev_ipddp = ipddp_init();
-        if (IS_ERR(dev_ipddp))
-                return PTR_ERR(dev_ipddp);
-       return 0;
+       return PTR_ERR_OR_ZERO(dev_ipddp);
 }
 
 static void __exit ipddp_cleanup_module(void)
index 1447a8352383707f35ab04a67c32c7c3bb0d97bc..2d3e5e263a326f777e8a577b70ac706dbf37e88c 100644 (file)
@@ -78,10 +78,7 @@ int brcmf_debug_attach(struct brcmf_pub *drvr)
                return -ENODEV;
 
        drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
-       if (IS_ERR(drvr->dbgfs_dir))
-               return PTR_ERR(drvr->dbgfs_dir);
-
-       return 0;
+       return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
 }
 
 void brcmf_debug_detach(struct brcmf_pub *drvr)