]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Input: i8042 - use cleanup facility for device_node
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Sun, 20 Oct 2024 04:15:41 +0000 (21:15 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 20 Oct 2024 04:21:42 +0000 (21:21 -0700)
Use the '__free(device_node)' macro to automatically free the device
node, removing the need for explicit calls to 'of_node_put()' to
decrement its refcount.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-8-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/serio/i8042-sparcio.h

index b4a5fcaac09f6730b32236f4021a2370e79ea2e4..0f97158fd14e613db4fffe0721ef368055ca4b22 100644 (file)
@@ -106,18 +106,10 @@ static struct platform_driver sparc_i8042_driver = {
 
 static bool i8042_is_mr_coffee(void)
 {
-       struct device_node *root;
-       const char *name;
-       bool is_mr_coffee;
+       struct device_node *root __free(device_node) = of_find_node_by_path("/");
+       const char *name = of_get_property(root, "name", NULL);
 
-       root = of_find_node_by_path("/");
-
-       name = of_get_property(root, "name", NULL);
-       is_mr_coffee = name && !strcmp(name, "SUNW,JavaStation-1");
-
-       of_node_put(root);
-
-       return is_mr_coffee;
+       return name && !strcmp(name, "SUNW,JavaStation-1");
 }
 
 static int __init i8042_platform_init(void)