drm/rockchip: vop: Fix unregister devfreq notifier unsuccessfully
authorFinley Xiao <finley.xiao@rock-chips.com>
Wed, 2 Aug 2017 08:19:50 +0000 (16:19 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 2 Aug 2017 13:31:11 +0000 (21:31 +0800)
Change-Id: I0d1e02eea2af59d63ea2948e14277aa6ad9955b6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_drm_vop.c

index 7b4e9ac4895659f02a7211db84a8ac8ecbdbbcc5..c2a7b9fe3161a861cdef850ad7626bd42c14b9e2 100644 (file)
@@ -3236,13 +3236,13 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
        for (i = 0; i < ARRAY_SIZE(dmc_vop); i++) {
                if (dmc_vop[i])
                        continue;
-               dmc_vop[i] = vop;
                if (devfreq_vop) {
-                       dmc_vop[i]->dmc_nb.notifier_call = dmc_notifier_call;
+                       vop->dmc_nb.notifier_call = dmc_notifier_call;
                        devfreq_register_notifier(devfreq_vop,
-                                                 &dmc_vop[i]->dmc_nb,
+                                                 &vop->dmc_nb,
                                                  DEVFREQ_TRANSITION_NOTIFIER);
                }
+               dmc_vop[i] = vop;
                break;
        }
 
@@ -3265,7 +3265,8 @@ static void vop_unbind(struct device *dev, struct device *master, void *data)
 
                if (!devfreq_vop)
                        break;
-               devfreq_unregister_notifier(devfreq_vop, &dmc_vop[i]->dmc_nb,
+               devfreq_unregister_notifier(devfreq_vop,
+                                           &vop->dmc_nb,
                                            DEVFREQ_TRANSITION_NOTIFIER);
                break;
        }