Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: i8042 - use cleanup facility for device_node

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>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
6243376d 8dee1dda

+3 -11
+3 -11
drivers/input/serio/i8042-sparcio.h
··· 106 106 107 107 static bool i8042_is_mr_coffee(void) 108 108 { 109 - struct device_node *root; 110 - const char *name; 111 - bool is_mr_coffee; 109 + struct device_node *root __free(device_node) = of_find_node_by_path("/"); 110 + const char *name = of_get_property(root, "name", NULL); 112 111 113 - root = of_find_node_by_path("/"); 114 - 115 - name = of_get_property(root, "name", NULL); 116 - is_mr_coffee = name && !strcmp(name, "SUNW,JavaStation-1"); 117 - 118 - of_node_put(root); 119 - 120 - return is_mr_coffee; 112 + return name && !strcmp(name, "SUNW,JavaStation-1"); 121 113 } 122 114 123 115 static int __init i8042_platform_init(void)