All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkiss: remove redundant check for len > 0
@ 2018-04-25 10:43 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-04-25 10:43 UTC (permalink / raw)
  To: David S . Miller, Johannes Berg, Stephen Hemminger, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check for len > 0 is always true and hence is redundant as
this check is already being made to execute the code inside the
while-loop. Hence it is redundant and can be removed.

Cleans up cppcheck warning:
drivers/net/hamradio/mkiss.c:220: (warning) Identical inner 'if'
condition is always true.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/hamradio/mkiss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index c180b480f8ef..13e4c1eff353 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -217,7 +217,7 @@ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
 			c = *s++;
 		else if (len > 1)
 			c = crc >> 8;
-		else if (len > 0)
+		else
 			c = crc & 0xff;
 
 		len--;
-- 
2.17.0

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

* [PATCH] mkiss: remove redundant check for len > 0
@ 2018-04-25 10:43 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-04-25 10:43 UTC (permalink / raw)
  To: David S . Miller, Johannes Berg, Stephen Hemminger, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check for len > 0 is always true and hence is redundant as
this check is already being made to execute the code inside the
while-loop. Hence it is redundant and can be removed.

Cleans up cppcheck warning:
drivers/net/hamradio/mkiss.c:220: (warning) Identical inner 'if'
condition is always true.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/hamradio/mkiss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index c180b480f8ef..13e4c1eff353 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -217,7 +217,7 @@ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
 			c = *s++;
 		else if (len > 1)
 			c = crc >> 8;
-		else if (len > 0)
+		else
 			c = crc & 0xff;
 
 		len--;
-- 
2.17.0


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

* Re: [PATCH] mkiss: remove redundant check for len > 0
  2018-04-25 10:43 ` Colin King
@ 2018-04-25 18:12   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-25 18:12 UTC (permalink / raw)
  To: colin.king; +Cc: johannes.berg, stephen, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Wed, 25 Apr 2018 11:43:07 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The check for len > 0 is always true and hence is redundant as
> this check is already being made to execute the code inside the
> while-loop. Hence it is redundant and can be removed.
> 
> Cleans up cppcheck warning:
> drivers/net/hamradio/mkiss.c:220: (warning) Identical inner 'if'
> condition is always true.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

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

* Re: [PATCH] mkiss: remove redundant check for len > 0
@ 2018-04-25 18:12   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-25 18:12 UTC (permalink / raw)
  To: colin.king; +Cc: johannes.berg, stephen, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Wed, 25 Apr 2018 11:43:07 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The check for len > 0 is always true and hence is redundant as
> this check is already being made to execute the code inside the
> while-loop. Hence it is redundant and can be removed.
> 
> Cleans up cppcheck warning:
> drivers/net/hamradio/mkiss.c:220: (warning) Identical inner 'if'
> condition is always true.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

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

end of thread, other threads:[~2018-04-25 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 10:43 [PATCH] mkiss: remove redundant check for len > 0 Colin King
2018-04-25 10:43 ` Colin King
2018-04-25 18:12 ` David Miller
2018-04-25 18:12   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.