Skip to content

Commit 98845e7

Browse files
nathanchancegroeck
authored andcommitted
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: b82b38a ("hwmon: (oxp-sensors) Add support for multiple new devices.") Signed-off-by: Nathan Chancellor <[email protected]> Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org> Signed-off-by: Guenter Roeck <[email protected]>
1 parent ebb75a3 commit 98845e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hwmon/oxp-sensors.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
478478
default:
479479
break;
480480
}
481+
break;
481482
default:
482483
break;
483484
}
@@ -550,9 +551,11 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
550551
default:
551552
break;
552553
}
554+
break;
553555
default:
554556
break;
555557
}
558+
break;
556559
default:
557560
break;
558561
}
@@ -604,6 +607,7 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
604607
default:
605608
break;
606609
}
610+
break;
607611
default:
608612
break;
609613
}

0 commit comments

Comments
 (0)