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

Input: twl4030-vibra - use cleanup facility for device_node

Use the '__free(device_node)' macro to simplify the code by
automatically freeing the device node.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-5-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
d3dcadd6 0ba9d3a5

+3 -8
+3 -8
drivers/input/misc/twl4030-vibra.c
··· 165 165 166 166 static bool twl4030_vibra_check_coexist(struct device_node *parent) 167 167 { 168 - struct device_node *node; 168 + struct device_node *node __free(device_node) = 169 + of_get_child_by_name(parent, "codec"); 169 170 170 - node = of_get_child_by_name(parent, "codec"); 171 - if (node) { 172 - of_node_put(node); 173 - return true; 174 - } 175 - 176 - return false; 171 + return node != NULL; 177 172 } 178 173 179 174 static int twl4030_vibra_probe(struct platform_device *pdev)