diff options
author | Javier Carrasco <javier.carrasco.cruz@gmail.com> | 2024-10-19 21:15:41 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-10-19 21:21:42 -0700 |
commit | 6243376d6a969fb4fa654a685599ec09b872bd20 (patch) | |
tree | 88051fcd173da88a7383e89c4d79cd80364721c1 | |
parent | 8dee1ddafa2f66c32d14af8e138e70ae7ace0292 (diff) | |
download | lwn-6243376d6a969fb4fa654a685599ec09b872bd20.tar.gz lwn-6243376d6a969fb4fa654a685599ec09b872bd20.zip |
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>
-rw-r--r-- | drivers/input/serio/i8042-sparcio.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index b4a5fcaac09f..0f97158fd14e 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) |