[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5453C98C.90105@users.sourceforge.net>
Date: Fri, 31 Oct 2014 18:40:28 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Ursula Braun <ursula.braun@...ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Frank Blaschka <blaschka@...ux.vnet.ibm.com>,
linux390@...ibm.com, linux-s390@...r.kernel.org
CC: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
trivial@...nel.org, Coccinelle <cocci@...teme.lip6.fr>
Subject: Re: [PATCH 1/1] s390/net: Deletion of unnecessary checks before two
function calls
The functions debug_unregister() and kfree_fsm() test whether their argument
is NULL and then return immediately. Thus the test around the call
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/s390/net/claw.c | 6 ++----
drivers/s390/net/ctcm_main.c | 6 ++----
drivers/s390/net/lcs.c | 6 ++----
drivers/s390/net/netiucv.c | 12 ++++--------
4 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 213e54e..d609ca0 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -109,10 +109,8 @@ static debug_info_t *claw_dbf_trace;
static void
claw_unregister_debug_facility(void)
{
- if (claw_dbf_setup)
- debug_unregister(claw_dbf_setup);
- if (claw_dbf_trace)
- debug_unregister(claw_dbf_trace);
+ debug_unregister(claw_dbf_setup);
+ debug_unregister(claw_dbf_trace);
}
static int
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index e056dd4..34dc0f3 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1074,8 +1074,7 @@ static void ctcm_free_netdevice(struct net_device *dev)
if (priv) {
grp = priv->mpcg;
if (grp) {
- if (grp->fsm)
- kfree_fsm(grp->fsm);
+ kfree_fsm(grp->fsm);
if (grp->xid_skb)
dev_kfree_skb(grp->xid_skb);
if (grp->rcvd_xid_skb)
@@ -1672,8 +1671,7 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
ctcm_free_netdevice(dev);
}
- if (priv->fsm)
- kfree_fsm(priv->fsm);
+ kfree_fsm(priv->fsm);
ccw_device_set_offline(cgdev->cdev[1]);
ccw_device_set_offline(cgdev->cdev[0]);
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 0a7d87c..5dfa7dd 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -88,10 +88,8 @@ static debug_info_t *lcs_dbf_trace;
static void
lcs_unregister_debug_facility(void)
{
- if (lcs_dbf_setup)
- debug_unregister(lcs_dbf_setup);
- if (lcs_dbf_trace)
- debug_unregister(lcs_dbf_trace);
+ debug_unregister(lcs_dbf_setup);
+ debug_unregister(lcs_dbf_trace);
}
static int
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 0a87809..bdcc3fe 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -487,12 +487,9 @@ DEFINE_PER_CPU(char[256], iucv_dbf_txt_buf);
static void iucv_unregister_dbf_views(void)
{
- if (iucv_dbf_setup)
- debug_unregister(iucv_dbf_setup);
- if (iucv_dbf_data)
- debug_unregister(iucv_dbf_data);
- if (iucv_dbf_trace)
- debug_unregister(iucv_dbf_trace);
+ debug_unregister(iucv_dbf_setup);
+ debug_unregister(iucv_dbf_data);
+ debug_unregister(iucv_dbf_trace);
}
static int iucv_register_dbf_views(void)
{
@@ -1975,8 +1972,7 @@ static void netiucv_free_netdevice(struct net_device *dev)
if (privptr) {
if (privptr->conn)
netiucv_remove_connection(privptr->conn);
- if (privptr->fsm)
- kfree_fsm(privptr->fsm);
+ kfree_fsm(privptr->fsm);
privptr->conn = NULL; privptr->fsm = NULL;
/* privptr gets freed by free_netdev() */
}
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists