Commit 9e913888 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Guenter Roeck
Browse files

hwmon: (smpro-hwmon) Improve switch statments in smpro_is_visible()

Clang warns:

  drivers/hwmon/smpro-hwmon.c:378:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
          default:
          ^
  drivers/hwmon/smpro-hwmon.c:378:2: note: insert 'break;' to avoid fall-through
          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. Additionally, adjust the
indentation of a break and add a default case to the inner switch
statement.

Fixes: a87456864cbb ("hwmon: Add Ampere's Altra smpro-hwmon driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/1751


Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20221027231611.3824800-1-nathan@kernel.org


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent b744db17
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -374,7 +374,10 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,
			if (ret || value == 0xFFFF)
				return 0;
			break;
		default:
			break;
		}
		break;
	default:
		break;
	}