summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>2024-10-19 21:07:41 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2024-10-19 21:21:40 -0700
commitd3dcadd654aefadebe847da74059dce6cc506e6b (patch)
tree1d62e4b14f7c38ab817667a4075d9aab96a6a5d2
parent0ba9d3a597c4446072f2a4326689b8858761c8f7 (diff)
downloadlinux-d3dcadd654aefadebe847da74059dce6cc506e6b.tar.gz
linux-d3dcadd654aefadebe847da74059dce6cc506e6b.tar.bz2
linux-d3dcadd654aefadebe847da74059dce6cc506e6b.zip
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>
-rw-r--r--drivers/input/misc/twl4030-vibra.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c
index 101548b35ee3..5fa7d4a7da36 100644
--- a/drivers/input/misc/twl4030-vibra.c
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -165,15 +165,10 @@ static DEFINE_SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
static bool twl4030_vibra_check_coexist(struct device_node *parent)
{
- struct device_node *node;
+ struct device_node *node __free(device_node) =
+ of_get_child_by_name(parent, "codec");
- node = of_get_child_by_name(parent, "codec");
- if (node) {
- of_node_put(node);
- return true;
- }
-
- return false;
+ return node != NULL;
}
static int twl4030_vibra_probe(struct platform_device *pdev)