hwmon: (nct7904) Avoid fall-through warnings
PATCH 1/1 hwmon: (nct7904) Avoid fall-through warnings
In preparation to enabling -Wimplicit-fallthrough, this patch silences the following warnings:
drivers/hwmon/nct7904.c: In function 'nct7904_in_is_visible':drivers/hwmon/nct7904.c:313:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (channel > 0 && (data->vsen_mask & BIT(index)))
^
drivers/hwmon/nct7904.c:315:2: note: here
case hwmon_in_min:
^~~~drivers/hwmon/nct7904.c: In function 'nct7904_fan_is_visible':drivers/hwmon/nct7904.c:230:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (data->fanin_mask & (1 << channel))
^
drivers/hwmon/nct7904.c:232:2: note: here
case hwmon_fan_min:
^~~~drivers/hwmon/nct7904.c: In function 'nct7904_temp_is_visible':drivers/hwmon/nct7904.c:443:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (channel < 5) {
^drivers/hwmon/nct7904.c:450:2: note: here
case hwmon_temp_max:
^~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
--- drivers/hwmon/nct7904.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hwmon/nct7904.c +3 -0
@@ -229,6 +229,7 @@ static umode_t nct7904_fan_is_visible(const void *_data, u32 attr, int channel)case hwmon_fan_alarm:if (data->fanin_mask & (1 << channel))return 0444 ; +break ;case hwmon_fan_min:if (data->fanin_mask & (1 << channel))return 0644 ;
@@ -312,6 +313,7 @@ static umode_t nct7904_in_is_visible(const void *_data, u32 attr, int channel)case hwmon_in_alarm:if (channel >0 && (data->vsen_mask &BIT (index)))return 0444 ; +break ;case hwmon_in_min:case hwmon_in_max:if (channel >0 && (data->vsen_mask &BIT (index)))
@@ -447,6 +449,7 @@ static umode_t nct7904_temp_is_visible(const void *_data, u32 attr, int channel)if (data->has_dts &BIT (channel -5 ))return 0444 ; } +break ;case hwmon_temp_max:case hwmon_temp_max_hyst:case hwmon_temp_emergency:
Signature · 1 line
2.21.0
Guenter Roeck
maintainerHi Gustavo,
Quoted 3 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, this patch silences the following warnings:
Thanks a lot for the patch. I pulled the patch introducing the problem due to other issues with it.
Guenter
Quoted 63 lines
drivers/hwmon/nct7904.c: In function 'nct7904_in_is_visible':drivers/hwmon/nct7904.c:313:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (channel > 0 && (data->vsen_mask& BIT(index)))^
drivers/hwmon/nct7904.c:315:2: note: here
casehwmon_in_min:
^~~~drivers/hwmon/nct7904.c: In function 'nct7904_fan_is_visible':drivers/hwmon/nct7904.c:230:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (data->fanin_mask& (1 << channel))^
drivers/hwmon/nct7904.c:232:2: note: here
casehwmon_fan_min:
^~~~drivers/hwmon/nct7904.c: In function 'nct7904_temp_is_visible':drivers/hwmon/nct7904.c:443:6: warning: this statement may fall through [-Wimplicit-fallthrough=]if (channel < 5) { ^
drivers/hwmon/nct7904.c:450:2: note: here
casehwmon_temp_max:
^~~~Warning level 3 was used: -Wimplicit-fallthrough=3
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/hwmon/nct7904.c | 3 +++ 1 file changed, 3 insertions(+)drivers/hwmon/nct7904.c +3
-0@@ -229,6 +229,7 @@ static umode_t nct7904_fan_is_visible(const void *_data, u32 attr, int channel)case hwmon_fan_alarm:if (data->fanin_mask & (1 << channel))return 0444 ; +break ;case hwmon_fan_min:if (data->fanin_mask & (1 << channel))return 0644 ;@@ -312,6 +313,7 @@ static umode_t nct7904_in_is_visible(const void *_data, u32 attr, int channel)case hwmon_in_alarm:if (channel >0 && (data->vsen_mask &BIT (index)))return 0444 ; +break ;case hwmon_in_min:case hwmon_in_max:if (channel >0 && (data->vsen_mask &BIT (index)))@@ -447,6 +449,7 @@ static umode_t nct7904_temp_is_visible(const void *_data, u32 attr, int channel)if (data->has_dts &BIT (channel -5 ))return 0444 ; } +break ;case hwmon_temp_max:case hwmon_temp_max_hyst:case hwmon_temp_emergency:Signature · 1 line
2.21.0