aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/misc/iqs7222.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc/iqs7222.c')
-rw-r--r--drivers/input/misc/iqs7222.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
index ddb863bf63ee..32515946bbca 100644
--- a/drivers/input/misc/iqs7222.c
+++ b/drivers/input/misc/iqs7222.c
@@ -2066,7 +2066,7 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index)
sldr_setup[4 + reg_offset] -= 2;
if (!fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val)) {
- if (!val || val > dev_desc->sldr_res) {
+ if (val > dev_desc->sldr_res) {
dev_err(&client->dev, "Invalid %s size: %u\n",
fwnode_get_name(sldr_node), val);
return -EINVAL;
@@ -2081,6 +2081,13 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index)
}
}
+ if (!(reg_offset ? sldr_setup[3]
+ : sldr_setup[2] & IQS7222_SLDR_SETUP_2_RES_MASK)) {
+ dev_err(&client->dev, "Undefined %s size\n",
+ fwnode_get_name(sldr_node));
+ return -EINVAL;
+ }
+
if (!fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val)) {
if (val > (reg_offset ? U16_MAX : U8_MAX * 4)) {
dev_err(&client->dev, "Invalid %s top speed: %u\n",