summaryrefslogtreecommitdiff
path: root/drivers/input/rmi4
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-11-08 05:11:56 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-11-08 05:11:56 +0300
commit0f1cd81d4a50ca99fb0b5cd8f68584bc5acab081 (patch)
treef0aa64e956d1d2addb2263ddcd238e9f014b36a0 /drivers/input/rmi4
parent4e974c120039e35b90d2cb0459452bd9a6a71594 (diff)
parent39dae59d66acd86d1de24294bd2f343fd5e7a625 (diff)
downloadlinux-0f1cd81d4a50ca99fb0b5cd8f68584bc5acab081.tar.xz
Merge tag 'v4.14-rc8' into next
Merge with mainline to bring in SPDX markings to avoid annoying merge problems when some header files get deleted.
Diffstat (limited to 'drivers/input/rmi4')
-rw-r--r--drivers/input/rmi4/Makefile1
-rw-r--r--drivers/input/rmi4/rmi_f30.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
index 9aaac3dd8613..f17631656987 100644
--- a/drivers/input/rmi4/Makefile
+++ b/drivers/input/rmi4/Makefile
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_RMI4_CORE) += rmi_core.o
rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
index 34dfee555b20..82e0f0d43d55 100644
--- a/drivers/input/rmi4/rmi_f30.c
+++ b/drivers/input/rmi4/rmi_f30.c
@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
unsigned int trackstick_button = BTN_LEFT;
bool button_mapped = false;
int i;
+ int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END);
f30->gpioled_key_map = devm_kcalloc(&fn->dev,
- f30->gpioled_count,
+ button_count,
sizeof(f30->gpioled_key_map[0]),
GFP_KERNEL);
if (!f30->gpioled_key_map) {
@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
return -ENOMEM;
}
- for (i = 0; i < f30->gpioled_count; i++) {
+ for (i = 0; i < button_count; i++) {
if (!rmi_f30_is_valid_button(i, f30->ctrl))
continue;