If an enum value were to get added without updating this switch
statement, the unreachable() annotation would trigger undefined
behavior, causing execution to fall through the end of the function,
into the next one.
Make the error handling more robust for an unexpected enum value, by
doing BUG() instead of unreachable().
Fixes the following objtool warning:
drivers/input/touchscreen/elants_i2c.o: warning: objtool: elants_i2c_initialize() falls through to next function elants_i2c_resume()
Reported-by: Randy Dunlap <redacted>
Acked-by: Randy Dunlap <redacted>
Signed-off-by: Josh Poimboeuf <redacted>
---
drivers/input/touchscreen/elants_i2c.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
From: Michał Mirosław <mirq-linux@rere.qmqm.pl> Date: 2021-02-11 02:21:16
On Wed, Feb 10, 2021 at 10:25:28AM -0600, Josh Poimboeuf wrote:
If an enum value were to get added without updating this switch
statement, the unreachable() annotation would trigger undefined
behavior, causing execution to fall through the end of the function,
into the next one.
Make the error handling more robust for an unexpected enum value, by
doing BUG() instead of unreachable().
Fixes the following objtool warning:
drivers/input/touchscreen/elants_i2c.o: warning: objtool: elants_i2c_initialize() falls through to next function elants_i2c_resume()
Reported-by: Randy Dunlap <redacted>
Acked-by: Randy Dunlap <redacted>
Signed-off-by: Josh Poimboeuf <redacted>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>