Skip to content

Commit

Permalink
Input: synaptics-rmi4 - use of_get_child_by_name() to fix refcount
Browse files Browse the repository at this point in the history
Calling of_find_node_by_name() assumes that the caller has incremented
the refcount of the of_node being passed in. Currently, the caller is
not incrementing the refcount of the of_node which results in the node
being prematurely freed when of_find_node_by_name() calls of_node_put()
on it. Instead use of_get_child_by_name() which does not call put on the
of_node.

Signed-off-by: Andrew Duggan <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
aduggan-syna authored and dtor committed Jul 14, 2016
1 parent 3e9161b commit 9624516
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/rmi4/rmi_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ static int rmi_function_match(struct device *dev, struct device_driver *drv)
static void rmi_function_of_probe(struct rmi_function *fn)
{
char of_name[9];
struct device_node *node = fn->rmi_dev->xport->dev->of_node;

snprintf(of_name, sizeof(of_name), "rmi4-f%02x",
fn->fd.function_number);
fn->dev.of_node = of_find_node_by_name(
fn->rmi_dev->xport->dev->of_node, of_name);
fn->dev.of_node = of_get_child_by_name(node, of_name);
}
#else
static inline void rmi_function_of_probe(struct rmi_function *fn)
Expand Down

0 comments on commit 9624516

Please sign in to comment.