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.

drm/panthor: Fix OPP refcnt leaks in devfreq initialisation

Rearrange lookup of recommended OPP for the Mali GPU device and its refcnt
decremental to make sure no OPP object leaks happen in the error path.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Fixes: fac9b22df4b1 ("drm/panthor: Add the devfreq logical block")
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241105205458.1318989-2-adrian.larumbe@collabora.com

authored by

Adrián Larumbe and committed by
Steven Price
21c23e4b 043e8afe

+8 -9
+8 -9
drivers/gpu/drm/panthor/panthor_devfreq.c
··· 163 163 164 164 cur_freq = clk_get_rate(ptdev->clks.core); 165 165 166 - opp = devfreq_recommended_opp(dev, &cur_freq, 0); 167 - if (IS_ERR(opp)) 168 - return PTR_ERR(opp); 169 - 170 - panthor_devfreq_profile.initial_freq = cur_freq; 171 - ptdev->current_frequency = cur_freq; 172 - 173 166 /* Regulator coupling only takes care of synchronizing/balancing voltage 174 167 * updates, but the coupled regulator needs to be enabled manually. 175 168 * ··· 193 200 return ret; 194 201 } 195 202 203 + opp = devfreq_recommended_opp(dev, &cur_freq, 0); 204 + if (IS_ERR(opp)) 205 + return PTR_ERR(opp); 206 + 207 + panthor_devfreq_profile.initial_freq = cur_freq; 208 + ptdev->current_frequency = cur_freq; 209 + 196 210 /* 197 211 * Set the recommend OPP this will enable and configure the regulator 198 212 * if any and will avoid a switch off by regulator_late_cleanup() 199 213 */ 200 214 ret = dev_pm_opp_set_opp(dev, opp); 215 + dev_pm_opp_put(opp); 201 216 if (ret) { 202 217 DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n"); 203 218 return ret; 204 219 } 205 - 206 - dev_pm_opp_put(opp); 207 220 208 221 /* Find the fastest defined rate */ 209 222 opp = dev_pm_opp_find_freq_floor(dev, &freq);