Skip to content

Commit d3dcadd

Browse files
javiercarrascocruzdtor
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 0ba9d3a commit d3dcadd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/input/misc/twl4030-vibra.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,10 @@ static DEFINE_SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
165165

166166
static bool twl4030_vibra_check_coexist(struct device_node *parent)
167167
{
168-
struct device_node *node;
168+
struct device_node *node __free(device_node) =
169+
of_get_child_by_name(parent, "codec");
169170

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;
177172
}
178173

179174
static int twl4030_vibra_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)