netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/net: Fix ptr_ret.cocci warnings.
@ 2017-07-25  7:00 Tonghao Zhang
  2017-07-25 19:27 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tonghao Zhang @ 2017-07-25  7:00 UTC (permalink / raw)
  To: netdev; +Cc: Tonghao Zhang

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>
---
 drivers/net/appletalk/ipddp.c                            | 4 +---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index a306de4..9375cef 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -311,9 +311,7 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 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)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
index 1447a83..2d3e5e2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
@@ -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)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/net: Fix ptr_ret.cocci warnings.
  2017-07-25  7:00 [PATCH] drivers/net: Fix ptr_ret.cocci warnings Tonghao Zhang
@ 2017-07-25 19:27 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-25 19:27 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: netdev

aFrom: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Tue, 25 Jul 2017 00:00:26 -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>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-25 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25  7:00 [PATCH] drivers/net: Fix ptr_ret.cocci warnings Tonghao Zhang
2017-07-25 19:27 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).