Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] watchdog: Mark expected switch fall-throughs
@ 2019-07-29 15:10 Gustavo A. R. Silva
  2019-07-29 16:43 ` Kees Cook
  2019-07-29 17:42 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-29 15:10 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Gustavo A. R. Silva,
	Geert Uytterhoeven, Kees Cook

Mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/watchdog/ar7_wdt.c: warning: this statement may fall
through [-Wimplicit-fallthrough=]:  => 237:3
drivers/watchdog/pcwd.c: warning: this statement may fall
through [-Wimplicit-fallthrough=]:  => 653:3
drivers/watchdog/sb_wdog.c: warning: this statement may fall
through [-Wimplicit-fallthrough=]:  => 204:3
drivers/watchdog/wdt.c: warning: this statement may fall
through [-Wimplicit-fallthrough=]:  => 391:3

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/watchdog/ar7_wdt.c | 1 +
 drivers/watchdog/pcwd.c    | 2 +-
 drivers/watchdog/sb_wdog.c | 1 +
 drivers/watchdog/wdt.c     | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index b9b2d06b3879..668a1c704f28 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -235,6 +235,7 @@ static long ar7_wdt_ioctl(struct file *file,
 		ar7_wdt_update_margin(new_margin);
 		ar7_wdt_kick(1);
 		spin_unlock(&wdt_lock);
+		/* Fall through */
 
 	case WDIOC_GETTIMEOUT:
 		if (put_user(margin, (int *)arg))
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c
index 1b2cf5b95a89..c3c93e00b320 100644
--- a/drivers/watchdog/pcwd.c
+++ b/drivers/watchdog/pcwd.c
@@ -651,7 +651,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			return -EINVAL;
 
 		pcwd_keepalive();
-		/* Fall */
+		/* Fall through */
 
 	case WDIOC_GETTIMEOUT:
 		return put_user(heartbeat, argp);
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 5a6ced7a7e8f..202fc8d8ca5f 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -202,6 +202,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 		timeout = time;
 		sbwdog_set(user_dog, timeout);
 		sbwdog_pet(user_dog);
+		/* Fall through */
 
 	case WDIOC_GETTIMEOUT:
 		/*
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index 0650100fad00..7d278b37e083 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -389,7 +389,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		if (wdt_set_heartbeat(new_heartbeat))
 			return -EINVAL;
 		wdt_ping();
-		/* Fall */
+		/* Fall through */
 	case WDIOC_GETTIMEOUT:
 		return put_user(heartbeat, p);
 	default:
-- 
2.22.0


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

* Re: [PATCH] watchdog: Mark expected switch fall-throughs
  2019-07-29 15:10 [PATCH] watchdog: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-29 16:43 ` Kees Cook
  2019-07-29 17:42 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-07-29 16:43 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel,
	Geert Uytterhoeven

On Mon, Jul 29, 2019 at 10:10:33AM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> drivers/watchdog/ar7_wdt.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 237:3
> drivers/watchdog/pcwd.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 653:3
> drivers/watchdog/sb_wdog.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 204:3
> drivers/watchdog/wdt.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 391:3
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/watchdog/ar7_wdt.c | 1 +
>  drivers/watchdog/pcwd.c    | 2 +-
>  drivers/watchdog/sb_wdog.c | 1 +
>  drivers/watchdog/wdt.c     | 2 +-
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
> index b9b2d06b3879..668a1c704f28 100644
> --- a/drivers/watchdog/ar7_wdt.c
> +++ b/drivers/watchdog/ar7_wdt.c
> @@ -235,6 +235,7 @@ static long ar7_wdt_ioctl(struct file *file,
>  		ar7_wdt_update_margin(new_margin);
>  		ar7_wdt_kick(1);
>  		spin_unlock(&wdt_lock);
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		if (put_user(margin, (int *)arg))
> diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c
> index 1b2cf5b95a89..c3c93e00b320 100644
> --- a/drivers/watchdog/pcwd.c
> +++ b/drivers/watchdog/pcwd.c
> @@ -651,7 +651,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  			return -EINVAL;
>  
>  		pcwd_keepalive();
> -		/* Fall */
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		return put_user(heartbeat, argp);
> diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
> index 5a6ced7a7e8f..202fc8d8ca5f 100644
> --- a/drivers/watchdog/sb_wdog.c
> +++ b/drivers/watchdog/sb_wdog.c
> @@ -202,6 +202,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
>  		timeout = time;
>  		sbwdog_set(user_dog, timeout);
>  		sbwdog_pet(user_dog);
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		/*
> diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
> index 0650100fad00..7d278b37e083 100644
> --- a/drivers/watchdog/wdt.c
> +++ b/drivers/watchdog/wdt.c
> @@ -389,7 +389,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  		if (wdt_set_heartbeat(new_heartbeat))
>  			return -EINVAL;
>  		wdt_ping();
> -		/* Fall */
> +		/* Fall through */
>  	case WDIOC_GETTIMEOUT:
>  		return put_user(heartbeat, p);
>  	default:
> -- 
> 2.22.0
> 

-- 
Kees Cook

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

* Re: [PATCH] watchdog: Mark expected switch fall-throughs
  2019-07-29 15:10 [PATCH] watchdog: Mark expected switch fall-throughs Gustavo A. R. Silva
  2019-07-29 16:43 ` Kees Cook
@ 2019-07-29 17:42 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-07-29 17:42 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel,
	Geert Uytterhoeven, Kees Cook

On Mon, Jul 29, 2019 at 10:10:33AM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> drivers/watchdog/ar7_wdt.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 237:3
> drivers/watchdog/pcwd.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 653:3
> drivers/watchdog/sb_wdog.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 204:3
> drivers/watchdog/wdt.c: warning: this statement may fall
> through [-Wimplicit-fallthrough=]:  => 391:3
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/ar7_wdt.c | 1 +
>  drivers/watchdog/pcwd.c    | 2 +-
>  drivers/watchdog/sb_wdog.c | 1 +
>  drivers/watchdog/wdt.c     | 2 +-
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
> index b9b2d06b3879..668a1c704f28 100644
> --- a/drivers/watchdog/ar7_wdt.c
> +++ b/drivers/watchdog/ar7_wdt.c
> @@ -235,6 +235,7 @@ static long ar7_wdt_ioctl(struct file *file,
>  		ar7_wdt_update_margin(new_margin);
>  		ar7_wdt_kick(1);
>  		spin_unlock(&wdt_lock);
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		if (put_user(margin, (int *)arg))
> diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c
> index 1b2cf5b95a89..c3c93e00b320 100644
> --- a/drivers/watchdog/pcwd.c
> +++ b/drivers/watchdog/pcwd.c
> @@ -651,7 +651,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  			return -EINVAL;
>  
>  		pcwd_keepalive();
> -		/* Fall */
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		return put_user(heartbeat, argp);
> diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
> index 5a6ced7a7e8f..202fc8d8ca5f 100644
> --- a/drivers/watchdog/sb_wdog.c
> +++ b/drivers/watchdog/sb_wdog.c
> @@ -202,6 +202,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
>  		timeout = time;
>  		sbwdog_set(user_dog, timeout);
>  		sbwdog_pet(user_dog);
> +		/* Fall through */
>  
>  	case WDIOC_GETTIMEOUT:
>  		/*
> diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
> index 0650100fad00..7d278b37e083 100644
> --- a/drivers/watchdog/wdt.c
> +++ b/drivers/watchdog/wdt.c
> @@ -389,7 +389,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  		if (wdt_set_heartbeat(new_heartbeat))
>  			return -EINVAL;
>  		wdt_ping();
> -		/* Fall */
> +		/* Fall through */
>  	case WDIOC_GETTIMEOUT:
>  		return put_user(heartbeat, p);
>  	default:
> -- 
> 2.22.0
> 

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 15:10 [PATCH] watchdog: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:43 ` Kees Cook
2019-07-29 17:42 ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org linux-watchdog@archiver.kernel.org
	public-inbox-index linux-watchdog


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/ public-inbox