Skip to contentSkip to conversation

watchdog: Mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Jul 29, 2019 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: Mark expected switch fall-throughs

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

---
 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(-)
drivers/watchdog/ar7_wdt.c +1 -0
index b9b2d06b3879..668a1c704f28 100644
@@ -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))
drivers/watchdog/pcwd.c +1 -1
index 1b2cf5b95a89..c3c93e00b320 100644
@@ -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);
drivers/watchdog/sb_wdog.c +1 -0
index 5a6ced7a7e8f..202fc8d8ca5f 100644
@@ -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:
 		/*
drivers/watchdog/wdt.c +1 -1
index 0650100fad00..7d278b37e083 100644
@@ -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:
Signature · 1 line
2.22.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Gustavo A. R. Silva

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

Quoted 2 lines

-Kees

Quoted 60 lines
---
 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(-)
drivers/watchdog/ar7_wdt.c +1 -0
index b9b2d06b3879..668a1c704f28 100644
@@ -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))
drivers/watchdog/pcwd.c +1 -1
index 1b2cf5b95a89..c3c93e00b320 100644
@@ -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);
drivers/watchdog/sb_wdog.c +1 -0
index 5a6ced7a7e8f..202fc8d8ca5f 100644
@@ -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:
 		/*
drivers/watchdog/wdt.c +1 -1
index 0650100fad00..7d278b37e083 100644
@@ -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:
Signature · 1 line
2.22.0
Signature · 1 line
Kees Cook
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 13 lines · Gustavo A. R. Silva

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

Quoted 2 lines
Quoted 60 lines
---
 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(-)
drivers/watchdog/ar7_wdt.c +1 -0
index b9b2d06b3879..668a1c704f28 100644
@@ -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))
drivers/watchdog/pcwd.c +1 -1
index 1b2cf5b95a89..c3c93e00b320 100644
@@ -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);
drivers/watchdog/sb_wdog.c +1 -0
index 5a6ced7a7e8f..202fc8d8ca5f 100644
@@ -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:
 		/*
drivers/watchdog/wdt.c +1 -1
index 0650100fad00..7d278b37e083 100644
@@ -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:
Signature · 1 line
2.22.0