drm/msm/adreno: Call dev_pm_opp_put()
authorJordan Crouse <jcrouse@codeaurora.org>
Tue, 21 Nov 2017 19:40:51 +0000 (12:40 -0700)
committerRob Clark <robdclark@gmail.com>
Wed, 10 Jan 2018 13:58:41 +0000 (08:58 -0500)
We need to call dev_pm_opp_put() to put back the reference
for the OPP struct after calling the various dev_pm_opp_get_*
functions.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/adreno/a5xx_power.c
drivers/gpu/drm/msm/adreno/adreno_device.c

index e5700bbf09dd2fe9ae6fa2d1fcd62ee7d02aa84e..4e4d965fd9ab5924aca6feb607e367c255b43c37 100644 (file)
@@ -103,10 +103,16 @@ static inline uint32_t _get_mvolts(struct msm_gpu *gpu, uint32_t freq)
        struct msm_drm_private *priv = dev->dev_private;
        struct platform_device *pdev = priv->gpu_pdev;
        struct dev_pm_opp *opp;
+       u32 ret = 0;
 
        opp = dev_pm_opp_find_freq_exact(&pdev->dev, freq, true);
 
-       return (!IS_ERR(opp)) ? dev_pm_opp_get_voltage(opp) / 1000 : 0;
+       if (!IS_ERR(opp)) {
+               ret = dev_pm_opp_get_voltage(opp) / 1000;
+               dev_pm_opp_put(opp);
+       }
+
+       return ret;
 }
 
 /* Setup thermal limit management */
index c30bd24bc92cf2ac0ea4ce4496096211819bdff9..5845e43521f7fa1e15d4e0fcc4e372fc547a1cf4 100644 (file)
@@ -247,8 +247,10 @@ static int adreno_get_pwrlevels(struct device *dev,
 
        /* Find the fastest defined rate */
        opp = dev_pm_opp_find_freq_floor(dev, &freq);
-       if (!IS_ERR(opp))
+       if (!IS_ERR(opp)) {
                config->fast_rate = dev_pm_opp_get_freq(opp);
+               dev_pm_opp_put(opp);
+       }
 
        if (!config->fast_rate) {
                DRM_DEV_INFO(dev,