thermal/drivers/sun8i: Free calibration nvmem after reading it
Subsystems (2)
Sasha Levin
maintainerPATCH 1/1 thermal/drivers/sun8i: Free calibration nvmem after reading it
From: Mark Brown <[email protected]>
[ Upstream commit c51592a95f360aabf2b8a5691c550e1749dc41eb ]
The sun8i thermal driver reads calibration data via the nvmem API at startup, updating the device configuration and not referencing the data again. Rather than explicitly freeing the nvmem data the driver relies on devm_ to release it, even though the data is never referenced again. The allocation is still tracked so it's not leaked but this is notable when looking at the code and is a little wasteful so let's instead explicitly free the nvmem after we're done with it.
Signed-off-by Mark Brown <[email protected]>
Acked-by Jernej Skrabec <[email protected]>
Signed-off-by Daniel Lezcano <[email protected]>
Signed-off-by Sasha Levin <[email protected]>
--- drivers/thermal/sun8i_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/thermal/sun8i_thermal.c +3 -1
@@ -285,7 +285,7 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev)size_t callen;int ret =0 ; - calcell =devm_nvmem_cell_get (dev,"calibration" ); + calcell =nvmem_cell_get (dev,"calibration" );if (IS_ERR (calcell)) {if (PTR_ERR (calcell) == -EPROBE_DEFER )return -EPROBE_DEFER ;
@@ -315,6 +315,8 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev)kfree (caldata); out: +if (!IS_ERR (calcell)) +nvmem_cell_put (calcell);return ret; }
Signature · 1 line
2.40.1