]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/chrome: cros_ec_typec: fix missing fwnode reference decrement
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Sun, 13 Oct 2024 13:20:24 +0000 (15:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:18 +0000 (13:54 +0100)
commit 9c41f371457bd9a24874e3c7934d9745e87fbc58 upstream.

The device_for_each_child_node() macro requires explicit calls to
fwnode_handle_put() upon early exits (return, break, goto) to decrement
the fwnode's refcount, and avoid levaing a node reference behind.

Add the missing fwnode_handle_put() after the common label for all error
paths.

Cc: stable@vger.kernel.org
Fixes: fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241013-cross_ec_typec_fwnode_handle_put-v2-1-9182b2cd7767@gmail.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/chrome/cros_ec_typec.c

index 4d305876ec08f6d87e7f2d6c3bb5478d26e1db36..8f5992cc805c522b3830f9567c999b0a7b728707 100644 (file)
@@ -409,6 +409,7 @@ static int cros_typec_init_ports(struct cros_typec_data *typec)
        return 0;
 
 unregister_ports:
+       fwnode_handle_put(fwnode);
        cros_unregister_ports(typec);
        return ret;
 }