Skip to content

Commit 00850d7

Browse files
javiercarrascocruzdtor
authored andcommitted
Input: ts4800-ts - 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent cd63c67 commit 00850d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/input/touchscreen/ts4800-ts.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,17 @@ static int ts4800_parse_dt(struct platform_device *pdev,
110110
{
111111
struct device *dev = &pdev->dev;
112112
struct device_node *np = dev->of_node;
113-
struct device_node *syscon_np;
114113
u32 reg, bit;
115114
int error;
116115

117-
syscon_np = of_parse_phandle(np, "syscon", 0);
116+
struct device_node *syscon_np __free(device_node) =
117+
of_parse_phandle(np, "syscon", 0);
118118
if (!syscon_np) {
119119
dev_err(dev, "no syscon property\n");
120120
return -ENODEV;
121121
}
122122

123123
ts->regmap = syscon_node_to_regmap(syscon_np);
124-
of_node_put(syscon_np);
125124
if (IS_ERR(ts->regmap)) {
126125
dev_err(dev, "cannot get parent's regmap\n");
127126
return PTR_ERR(ts->regmap);

0 commit comments

Comments
 (0)