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

Configure Feed

Select the types of activity you want to include in your feed.

misc: ti_fpc202: fix a potential memory leak in probe function

Use for_each_child_of_node_scoped() to simplify the code and ensure the
device node reference is automatically released when the loop scope
ends.

Signed-off-by: Felix Gu <gu_0233@qq.com>
Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>
Link: https://patch.msgid.link/tencent_FA1AC670F5CF49873F88A44424F866994A08@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Felix Gu and committed by
Greg Kroah-Hartman
dad9f13d 40fc797b

+1 -2
+1 -2
drivers/misc/ti_fpc202.c
··· 309 309 static int fpc202_probe(struct i2c_client *client) 310 310 { 311 311 struct device *dev = &client->dev; 312 - struct device_node *i2c_handle; 313 312 struct fpc202_priv *priv; 314 313 int ret, port_id; 315 314 ··· 356 357 357 358 bitmap_zero(priv->probed_ports, FPC202_NUM_PORTS); 358 359 359 - for_each_child_of_node(dev->of_node, i2c_handle) { 360 + for_each_child_of_node_scoped(dev->of_node, i2c_handle) { 360 361 ret = of_property_read_u32(i2c_handle, "reg", &port_id); 361 362 if (ret) { 362 363 if (ret == -EINVAL)