Skip to content

Commit 6243376

Browse files
javiercarrascocruzdtor
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 8dee1dd commit 6243376

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/input/serio/i8042-sparcio.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,10 @@ static struct platform_driver sparc_i8042_driver = {
106106

107107
static bool i8042_is_mr_coffee(void)
108108
{
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);
112111

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");
121113
}
122114

123115
static int __init i8042_platform_init(void)

0 commit comments

Comments
 (0)