Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 04e49867fad1 ("Input: add support for Azoteq IQS269A")
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/Y7Rsx68k/gvDVXAt@nixie71
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jeff LaBundy and committed by
Dmitry Torokhov
59bc9cb3 407da561

+11 -1
+11 -1
drivers/input/misc/iqs269a.c
··· 694 694 dev_err(&client->dev, 695 695 "Invalid channel %u threshold: %u\n", 696 696 reg, val); 697 + fwnode_handle_put(ev_node); 697 698 return -EINVAL; 698 699 } 699 700 ··· 708 707 dev_err(&client->dev, 709 708 "Invalid channel %u hysteresis: %u\n", 710 709 reg, val); 710 + fwnode_handle_put(ev_node); 711 711 return -EINVAL; 712 712 } 713 713 ··· 723 721 } 724 722 } 725 723 726 - if (fwnode_property_read_u32(ev_node, "linux,code", &val)) 724 + error = fwnode_property_read_u32(ev_node, "linux,code", &val); 725 + fwnode_handle_put(ev_node); 726 + if (error == -EINVAL) { 727 727 continue; 728 + } else if (error) { 729 + dev_err(&client->dev, 730 + "Failed to read channel %u code: %d\n", reg, 731 + error); 732 + return error; 733 + } 728 734 729 735 switch (reg) { 730 736 case IQS269_CHx_HALL_ACTIVE: