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>
This commit is contained in:
Javier Carrasco 2024-10-19 21:15:41 -07:00 committed by Dmitry Torokhov
parent 8dee1ddafa
commit 6243376d6a

View 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)