Skip to contentSkip to conversation

fs: annotate implicit fall throughs

PATCH New Mathieu Malaterre 1 participant 3 messages Jan 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 fs: annotate implicit fall throughs

There is a plan to build the kernel with -Wimplicit-fallthrough and these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warnings:

fs/libfs.c:148:11: warning: this statement may fall through [-Wimplicit-fallthrough=] fs/libfs.c:150:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
 fs/libfs.c | 2 ++
 1 file changed, 2 insertions(+)
fs/libfs.c +2 -0
index 0fb590d79f30..9efb647917e0 100644
@@ -146,9 +146,11 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
 	switch (whence) {
 		case 1:
 			offset += file->f_pos;
+			/* fall through */
 		case 0:
 			if (offset >= 0)
 				break;
+			/* fall through */
 		default:
 			return -EINVAL;
 	}
Signature · 1 line
2.19.2
#1 lore raw

PATCH 2/3 fs: annotate implicit fall through

There is a plan to build the kernel with -Wimplicit-fallthrough and this place in the code produced a warning (W=1).

In this particular case remove a ‘:’ so as to match the regular expression expected by GCC.

This commit remove the following warning:

fs/locks.c:1473:16: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
index ff6af2c32601..d958c3863b4b 100644
@@ -1471,7 +1471,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
 	switch (arg) {
 	case F_UNLCK:
 		fl->fl_flags &= ~FL_UNLOCK_PENDING;
-		/* fall through: */
+		/* fall through */
 	case F_RDLCK:
 		fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
 	}
Signature · 1 line
2.19.2
#2 lore raw

PATCH 3/3 fs/fcntl: annotate implicit fall through

In reply to Mathieu Malaterre

There is a plan to build the kernel with -Wimplicit-fallthrough and this place in the code produced a warning (W=1).

In this particular case change a ‘:’ with a ‘-’ so as to match the regular expression expected by GCC.

This commit remove the following warning:

fs/fcntl.c:770:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
 fs/fcntl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fcntl.c +1 -1
index 083185174c6d..3d40771e8e7c 100644
@@ -769,7 +769,7 @@ static void send_sigio_to_task(struct task_struct *p,
 			si.si_fd    = fd;
 			if (!do_send_sig_info(signum, &si, p, type))
 				break;
-		/* fall-through: fall back on the old plain SIGIO signal */
+		/* fall-through - fall back on the old plain SIGIO signal */
 		case 0:
 			do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
 	}
Signature · 1 line
2.19.2