Re: [PATCH 18/28] dpll: zl3073x: Read optional pin properties from firmware

From: Ivan Vecera
Date: Wed Apr 09 2025 - 03:23:08 EST




On 07. 04. 25 8:06 odp., Krzysztof Kozlowski wrote:
On 07/04/2025 19:31, Ivan Vecera wrote:
+
+ if (zl3073x_dpll_is_input_pin(pin))
+ node_name = "input-pins";
+ else
+ node_name = "output-pins";
+
+ /* Get node containing input or output pins */
+ pins_node = device_get_named_child_node(zldpll->mfd->dev, node_name);
+ if (!pins_node) {
+ dev_dbg(zldpll->mfd->dev, "'%s' sub-node is missing\n",
+ node_name);
+ return NULL;
+ }
+
+ /* Get pin HW index */
+ idx = zl3073x_dpll_pin_index_get(pin);
+
+ /* Enumerate pin nodes and find the requested one */
+ fwnode_for_each_child_node(pins_node, pin_node) {
+ u32 reg;
+
+ if (fwnode_property_read_u32(pin_node, "reg", &reg))
+ continue;
+
+ if (idx == reg)
+ break;

Where do you drop the reference to pin_node?

The pin_node is a return value of this function. It is stored into pin_info->fwnode (in zl3073x_dpll_pin_info_get()) and later the reference is dropped by zl3073x_dpll_pin_info_put().

+ }
+
+ /* Release pin parent node */
+ fwnode_handle_put(pins_node);
+



Best regards,
Krzysztof