summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2021-02-11 12:50:37 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2021-02-16 13:08:50 -0800
commitede6747c2f8975892ab98bed94357dc8c35d790c (patch)
tree73d4f2830f962d4900e41590cb1ecee0d2968013 /drivers/input
parenta374c19f7f15e3b2c85b3d8753c63e16dbb22d2e (diff)
downloadlinux-stable-ede6747c2f8975892ab98bed94357dc8c35d790c.tar.gz
linux-stable-ede6747c2f8975892ab98bed94357dc8c35d790c.tar.bz2
linux-stable-ede6747c2f8975892ab98bed94357dc8c35d790c.zip
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: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/elants_i2c.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 6f57ec579f00..4c2b579f6c8b 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -656,8 +656,7 @@ static int elants_i2c_initialize(struct elants_data *ts)
error = elants_i2c_query_ts_info_ektf(ts);
break;
default:
- unreachable();
- break;
+ BUG();
}
if (error)