]> www.infradead.org Git - nvme.git/commit
usb: typec: ucsi: glink: fix child node release in probe function
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Thu, 13 Jun 2024 12:14:48 +0000 (14:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Jun 2024 17:36:29 +0000 (19:36 +0200)
commitc68942624e254a4e8a65afcd3c17ed95acda5489
tree4e1638d094671040e0c19934af39c7ca394145fc
parentde644a4a86be04ed8a43ef8267d0f7d021941c5e
usb: typec: ucsi: glink: fix child node release in probe function

The device_for_each_child_node() macro requires explicit calls to
fwnode_handle_put() in all early exits of the loop if the child node is
not required outside. Otherwise, the child node's refcount is not
decremented and the resource is not released.

The current implementation of pmic_glink_ucsi_probe() makes use of the
device_for_each_child_node(), but does not release the child node on
early returns. Add the missing calls to fwnode_handle_put().

Cc: stable@vger.kernel.org
Fixes: c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240613-ucsi-glink-release-node-v1-1-f7629a56f70a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi_glink.c