From: Javier Carrasco Date: Sun, 20 Oct 2024 04:15:41 +0000 (-0700) Subject: Input: i8042 - use cleanup facility for device_node X-Git-Tag: v6.13-rc1~95^2^2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6243376d6a969fb4fa654a685599ec09b872bd20;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-8-ebc62138fbf8@gmail.com Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index b4a5fcaac09f6..0f97158fd14e6 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -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)