From 64bc0124581b49093f5c348f5debe8889a56fedd Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Thu, 27 Mar 2025 15:33:07 +0000 Subject: [PATCH] mtd: ubi: annotate fallthrough The UBI code uses an implicit switch/case fallthrough when handling two related cases of bad header errors. Also there is a switch/case for unit prefix handling (G/M/K), which accumulates multiplications. Add our "fallthrough;" statement-like macro before the respective labels in both cases, to avoid a warning when GCC's -Wimplicit-fallthrough warning option is enabled. Signed-off-by: Andre Przywara Reviewed-by: Heiko Schocher --- drivers/mtd/ubi/attach.c | 1 + drivers/mtd/ubi/build.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index 2ef8fde3d32..306da509ec4 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -934,6 +934,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, * be a result of power cut during erasure. */ ai->maybe_bad_peb_count += 1; + fallthrough; case UBI_IO_BAD_HDR: if (ec_err) /* diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 104537784ab..50e43928af0 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1400,12 +1400,15 @@ static int __init bytes_str_to_int(const char *str) switch (*endp) { case 'G': result *= 1024; + fallthrough; case 'M': result *= 1024; + fallthrough; case 'K': result *= 1024; if (endp[1] == 'i' && endp[2] == 'B') endp += 2; + fallthrough; case '\0': break; default: