Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271593 > unrolled thread

[PATCH] s390-ctcm: Delete unnecessary checks before the function call "channel_remove"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-17 20:30 +0100
Last post2015-11-25 10:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] s390-ctcm: Delete unnecessary checks before the function call  "channel_remove" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-17 20:30 +0100
    Re: [PATCH] s390-ctcm: Delete unnecessary checks before the  function call "channel_remove" Ursula Braun <ubraun@linux.vnet.ibm.com> - 2015-11-25 10:40 +0100

#1271593 — [PATCH] s390-ctcm: Delete unnecessary checks before the function call "channel_remove"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-17 20:30 +0100
Subject[PATCH] s390-ctcm: Delete unnecessary checks before the function call "channel_remove"
Message-ID<qvU70-N7-23@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Nov 2015 20:10:02 +0100

The channel_remove() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/net/ctcm_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 05c37d6..c3e2252 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1677,11 +1677,8 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
 
 	ccw_device_set_offline(cgdev->cdev[1]);
 	ccw_device_set_offline(cgdev->cdev[0]);
-
-	if (priv->channel[CTCM_READ])
-		channel_remove(priv->channel[CTCM_READ]);
-	if (priv->channel[CTCM_WRITE])
-		channel_remove(priv->channel[CTCM_WRITE]);
+	channel_remove(priv->channel[CTCM_READ]);
+	channel_remove(priv->channel[CTCM_WRITE]);
 	priv->channel[CTCM_READ] = priv->channel[CTCM_WRITE] = NULL;
 
 	return 0;
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1277132 — Re: [PATCH] s390-ctcm: Delete unnecessary checks before the function call "channel_remove"

FromUrsula Braun <ubraun@linux.vnet.ibm.com>
Date2015-11-25 10:40 +0100
SubjectRe: [PATCH] s390-ctcm: Delete unnecessary checks before the function call "channel_remove"
Message-ID<qyEIq-4jh-21@gated-at.bofh.it>
In reply to#1271593
Applied to our local git. Thanks. It will be part of my next patch
submission for net-next.

Kind regards, Ursula Braun, IBM Germany

On Tue, 2015-11-17 at 20:20 +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Nov 2015 20:10:02 +0100
> 
> The channel_remove() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/s390/net/ctcm_main.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
> index 05c37d6..c3e2252 100644
> --- a/drivers/s390/net/ctcm_main.c
> +++ b/drivers/s390/net/ctcm_main.c
> @@ -1677,11 +1677,8 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
> 
>  	ccw_device_set_offline(cgdev->cdev[1]);
>  	ccw_device_set_offline(cgdev->cdev[0]);
> -
> -	if (priv->channel[CTCM_READ])
> -		channel_remove(priv->channel[CTCM_READ]);
> -	if (priv->channel[CTCM_WRITE])
> -		channel_remove(priv->channel[CTCM_WRITE]);
> +	channel_remove(priv->channel[CTCM_READ]);
> +	channel_remove(priv->channel[CTCM_WRITE]);
>  	priv->channel[CTCM_READ] = priv->channel[CTCM_WRITE] = NULL;
> 
>  	return 0;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web