]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
authorNathan Chancellor <nathan@kernel.org>
Wed, 28 Aug 2024 18:05:35 +0000 (11:05 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 28 Aug 2024 20:33:53 +0000 (13:33 -0700)
commit98845e7753902937da24b9053537b7936c916abd
treee2171b6a068ca03c5607576110088de426836f41
parentebb75a3c5265ceeebd2b0708d013735e5eafbb69
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang

clang warns (or errors due to CONFIG_WERROR):

  drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

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 breaks to
silence the warnings.

Fixes: b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/oxp-sensors.c