Commit 59bc9cb3 authored by Jeff LaBundy's avatar Jeff LaBundy Committed by Dmitry Torokhov

Input: iqs269a - drop unused device node references

Each call to device/fwnode_get_named_child_node() must be matched
with a call to fwnode_handle_put() once the corresponding node is
no longer in use. This ensures a reference count remains balanced
in the case of dynamic device tree support.

Currently, the driver does not call fwnode_handle_put() on nested
event nodes. This patch solves this problem by adding the missing
instances of fwnode_handle_put().

As part of this change, the logic which parses each channel's key
code is gently refactored in order to reduce the number of places
from which fwnode_handle_put() is called.

Fixes: 04e49867 ("Input: add support for Azoteq IQS269A")
Signed-off-by: default avatarJeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/Y7Rsx68k/gvDVXAt@nixie71Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 407da561
...@@ -694,6 +694,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, ...@@ -694,6 +694,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
dev_err(&client->dev, dev_err(&client->dev,
"Invalid channel %u threshold: %u\n", "Invalid channel %u threshold: %u\n",
reg, val); reg, val);
fwnode_handle_put(ev_node);
return -EINVAL; return -EINVAL;
} }
...@@ -707,6 +708,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, ...@@ -707,6 +708,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
dev_err(&client->dev, dev_err(&client->dev,
"Invalid channel %u hysteresis: %u\n", "Invalid channel %u hysteresis: %u\n",
reg, val); reg, val);
fwnode_handle_put(ev_node);
return -EINVAL; return -EINVAL;
} }
...@@ -721,8 +723,16 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, ...@@ -721,8 +723,16 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
} }
} }
if (fwnode_property_read_u32(ev_node, "linux,code", &val)) error = fwnode_property_read_u32(ev_node, "linux,code", &val);
fwnode_handle_put(ev_node);
if (error == -EINVAL) {
continue; continue;
} else if (error) {
dev_err(&client->dev,
"Failed to read channel %u code: %d\n", reg,
error);
return error;
}
switch (reg) { switch (reg) {
case IQS269_CHx_HALL_ACTIVE: case IQS269_CHx_HALL_ACTIVE:
......
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