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

regulator: tps65217: Fix using wrong dev argument for calling of_regulator_match

The dev parameter is the device requestiong the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Axel Lin and committed by
Mark Brown
5bce833c 7d1f9aef

+2 -2
+2 -2
drivers/regulator/tps65217-regulator.c
··· 305 305 if (!regs) 306 306 return NULL; 307 307 308 - count = of_regulator_match(pdev->dev.parent, regs, 309 - reg_matches, TPS65217_NUM_REGULATOR); 308 + count = of_regulator_match(&pdev->dev, regs, reg_matches, 309 + TPS65217_NUM_REGULATOR); 310 310 of_node_put(regs); 311 311 if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) 312 312 return NULL;