hwmon: (smpro-hwmon) Add missing break in smpro_is_visible()
PATCH 1/1 hwmon: (smpro-hwmon) Add missing break 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.
--- drivers/hwmon/smpro-hwmon.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/smpro-hwmon.c +1 -0
@@ -375,6 +375,7 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,return 0 ;break ; } +break ;default :break ; }
base-commit: 0ffb687b6508c36a17b99bdaf014b38532404182
Signature · 1 line
2.38.1
Guenter Roeck
maintainerQuoted 30 lines · Nathan Chancellor
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.Fixes a87456864cbb ("hwmon: Add Ampere's Altra smpro-hwmon driver")Signed-off-by Nathan Chancellor <[email protected]>--- drivers/hwmon/smpro-hwmon.c | 1 + 1 file changed, 1 insertion(+)drivers/hwmon/smpro-hwmon.c +0
-0
drivers/hwmon/smpro-hwmon.c static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, · line 378
Quoted 4 lines
drivers/hwmon/smpro-hwmon.c +1
-0@@ -375,6 +375,7 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,return 0 ;break ; } +break ;
The alignment of the break; statement above is also bad, and a default:
for switch (attr) is missing.
Guenter
Quoted 8 lines
drivers/hwmon/smpro-hwmon.c +0
-0default :break ; }base-commit:
0ffb687b6508c36a17b99bdaf014b38532404182Signature · 1 line
2.38.1
Quoted 26 lines · Guenter Roeck
Quoted 25 lines · Nathan Chancellor
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.Fixes a87456864cbb ("hwmon: Add Ampere's Altra smpro-hwmon driver")Signed-off-by Nathan Chancellor <[email protected]>--- drivers/hwmon/smpro-hwmon.c | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
drivers/hwmon/smpro-hwmon.c static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, · line 378
Quoted 9 lines
drivers/hwmon/smpro-hwmon.c +1
-0@@ -375,6 +375,7 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,return 0 ;break ; } +break ;The alignment of the break; statement above is also bad, and a default:
for switch (attr) is missing.
Would you prefer those fixed in the same patch or a separate one?
Quoted 8 lines
Quoted 8 lines
drivers/hwmon/smpro-hwmon.c +0
-0default :break ; }base-commit:
0ffb687b6508c36a17b99bdaf014b38532404182Signature · 1 line
2.38.1
Guenter Roeck
maintainerQuoted 40 lines · Nathan Chancellor
Quoted 26 lines · Guenter Roeck
Quoted 25 lines · Nathan Chancellor
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.Fixes a87456864cbb ("hwmon: Add Ampere's Altra smpro-hwmon driver")Signed-off-by Nathan Chancellor <[email protected]>--- drivers/hwmon/smpro-hwmon.c | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
drivers/hwmon/smpro-hwmon.c static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, · line 378
Quoted 9 lines
drivers/hwmon/smpro-hwmon.c +1
-0@@ -375,6 +375,7 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,return 0 ;break ; } +break ;The alignment of the break; statement above is also bad, and a default:
for switch (attr) is missing.
Quoted 2 lines
Would you prefer those fixed in the same patch or a separate one?
Same patch, please. The resulting code is ultimately the same.
Thanks,
Guenter
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/hwmon/smpro-hwmon.c +0
-0default :break ; }base-commit:
0ffb687b6508c36a17b99bdaf014b38532404182Signature · 1 line
2.38.1