Skip to contentSkip to conversation

platform/chrome: cros_ec_typec: Put fwnode in error case during ->probe()

PATCH New Andy Shevchenko 1 participant 1 message Jun 15, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 platform/chrome: cros_ec_typec: Put fwnode in error case during ->probe()

device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.

Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")

---
v2: added comment (Prashant), added Rb tag (Prashant)

 drivers/platform/chrome/cros_ec_typec.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +2 -0
index 27c068c4c38d..99fdc1156392 100644
@@ -375,6 +375,8 @@ static int cros_typec_init_ports(struct cros_typec_data *typec)
 	return 0;
 
 unregister_ports:
+	/* Drop the referece that bumped by device_for_each_child_node() */
+	fwnode_handle_put(fwnode);
 	cros_unregister_ports(typec);
 	return ret;
 }
Signature · 1 line
2.32.0