diff options
author | Nathan Chancellor <nathan@kernel.org> | 2022-10-28 02:16:12 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2022-12-05 03:45:02 +0300 |
commit | 9e913888647be447c3d114042428f02d24676390 (patch) | |
tree | dd2cf408458c40fabf17cb9bf1cd179e7de9e56f /drivers/hwmon | |
parent | b744db17abf6a2efc2bfa80870cc88e9799a8ccc (diff) | |
download | linux-9e913888647be447c3d114042428f02d24676390.tar.xz |
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: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20221027231611.3824800-1-nathan@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/smpro-hwmon.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hwmon/smpro-hwmon.c b/drivers/hwmon/smpro-hwmon.c index ee54e21c2c12..a76c49dd8438 100644 --- a/drivers/hwmon/smpro-hwmon.c +++ b/drivers/hwmon/smpro-hwmon.c @@ -373,8 +373,11 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value); if (ret || value == 0xFFFF) return 0; - break; + break; + default: + break; } + break; default: break; } |