Commit ede6747c authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Dmitry Torokhov

Input: elants_i2c - detect enum overflow

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: default avatarRandy Dunlap <rdunlap@infradead.org>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a374c19f
...@@ -656,8 +656,7 @@ static int elants_i2c_initialize(struct elants_data *ts) ...@@ -656,8 +656,7 @@ static int elants_i2c_initialize(struct elants_data *ts)
error = elants_i2c_query_ts_info_ektf(ts); error = elants_i2c_query_ts_info_ektf(ts);
break; break;
default: default:
unreachable(); BUG();
break;
} }
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment