diff mbox series

i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work()

Message ID 20250319-i3c-fix-clang-fallthrough-v1-1-d8e02be1ef5c@kernel.org (mailing list archive)
State Accepted
Commit e8d2d287e26d9bd9114cf258a123a6b70812442e
Headers show
Series i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work() | expand

Commit Message

Nathan Chancellor March 19, 2025, 4:08 p.m. UTC
Clang warns (or errors with CONFIG_WERROR=y):

  drivers/i3c/master/svc-i3c-master.c:596:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    596 |         default:
        |         ^
  drivers/i3c/master/svc-i3c-master.c:596:2: note: insert 'break;' to avoid fall-through
    596 |         default:
        |         ^
        |         break;
  1 error generated.

Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing break to silence
the warning.

Fixes: 0430bf9bc1ac ("i3c: master: svc: Fix missing STOP for master request")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/i3c/master/svc-i3c-master.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: 0430bf9bc1ac068c8b8c540eb93e5751872efc51
change-id: 20250319-i3c-fix-clang-fallthrough-9f5c7cf5e799

Best regards,

Comments

Alexandre Belloni March 20, 2025, 10:03 p.m. UTC | #1
On Wed, 19 Mar 2025 09:08:01 -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
> 
>   drivers/i3c/master/svc-i3c-master.c:596:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
>     596 |         default:
>         |         ^
>   drivers/i3c/master/svc-i3c-master.c:596:2: note: insert 'break;' to avoid fall-through
>     596 |         default:
>         |         ^
>         |         break;
>   1 error generated.
> 
> [...]

Applied, thanks!

[1/1] i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work()
      https://git.kernel.org/abelloni/c/e8d2d287e26d

Best regards,
diff mbox series

Patch

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index e0cd3ce28b7f..85e16de208d3 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -593,6 +593,7 @@  static void svc_i3c_master_ibi_work(struct work_struct *work)
 		break;
 	case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST:
 		svc_i3c_master_emit_stop(master);
+		break;
 	default:
 		break;
 	}