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

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 <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-10-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
00850d7b cd63c67b

+2 -3
+2 -3
drivers/input/touchscreen/ts4800-ts.c
··· 110 110 { 111 111 struct device *dev = &pdev->dev; 112 112 struct device_node *np = dev->of_node; 113 - struct device_node *syscon_np; 114 113 u32 reg, bit; 115 114 int error; 116 115 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); 118 118 if (!syscon_np) { 119 119 dev_err(dev, "no syscon property\n"); 120 120 return -ENODEV; 121 121 } 122 122 123 123 ts->regmap = syscon_node_to_regmap(syscon_np); 124 - of_node_put(syscon_np); 125 124 if (IS_ERR(ts->regmap)) { 126 125 dev_err(dev, "cannot get parent's regmap\n"); 127 126 return PTR_ERR(ts->regmap);