--- initial
+++ final
@@ -1,160 +1,160 @@
 static int msm_drm_init(struct device *dev, struct drm_driver *drv) {
   struct platform_device *pdev = to_platform_device(dev);
   struct drm_device *ddev;
   struct msm_drm_private *priv;
   struct msm_kms *kms;
   struct msm_mdss *mdss;
   int ret, i;
   struct sched_param param;
   ddev = drm_dev_alloc(drv, dev);
   if (IS_ERR(ddev)) {
     dev_err(dev, "failed to allocate drm_device\n");
     return PTR_ERR(ddev);
   }
   platform_set_drvdata(pdev, ddev);
   priv = kzalloc(sizeof(*priv), GFP_KERNEL);
   if (!priv) {
     ret = -ENOMEM;
     goto err_unref_drm_dev;
   }
   ddev->dev_private = priv;
   priv->dev = ddev;
   switch (get_mdp_ver(pdev)) {
   case KMS_MDP5: ret = mdp5_mdss_init(ddev); break;
   case KMS_DPU: ret = dpu_mdss_init(ddev); break;
   default: ret = 0; break;
   }
   if (ret) goto err_free_priv;
   mdss = priv->mdss;
   priv->wq = alloc_ordered_workqueue("msm", 0);
   INIT_LIST_HEAD(&priv->inactive_list);
   INIT_LIST_HEAD(&priv->vblank_ctrl.event_list);
   kthread_init_work(&priv->vblank_ctrl.work, vblank_ctrl_worker);
   spin_lock_init(&priv->vblank_ctrl.lock);
   drm_mode_config_init(ddev);
   /* Bind all our sub-components: */
   ret = component_bind_all(dev, ddev);
   if (ret) goto err_destroy_mdss;
   ret = msm_init_vram(ddev);
   if (ret) goto err_msm_uninit;
   msm_gem_shrinker_init(ddev);
   switch (get_mdp_ver(pdev)) {
   case KMS_MDP4:
     kms = mdp4_kms_init(ddev);
     priv->kms = kms;
     break;
   case KMS_MDP5: kms = mdp5_kms_init(ddev); break;
   case KMS_DPU:
     kms = dpu_kms_init(ddev);
     priv->kms = kms;
     break;
   default: kms = ERR_PTR(-ENODEV); break;
   }
   if (IS_ERR(kms)) {
     /*
      * NOTE: once we have GPU support, having no kms should not
      * be considered fatal.. ideally we would still support gpu
      * and (for example) use dmabuf/prime to share buffers with
      * imx drm driver on iMX5
      */
     dev_err(dev, "failed to load kms\n");
     ret = PTR_ERR(kms);
     goto err_msm_uninit;
   }
   /* Enable normalization of plane zpos */
   ddev->mode_config.normalize_zpos = true;
   if (kms) {
     ret = kms->funcs->hw_init(kms);
     if (ret) {
       dev_err(dev, "kms hw init failed: %d\n", ret);
       goto err_msm_uninit;
     }
   }
   ddev->mode_config.funcs = &mode_config_funcs;
   ddev->mode_config.helper_private = &mode_config_helper_funcs;
   /**
    * this priority was found during empiric testing to have appropriate
    * realtime scheduling to process display updates and interact with
    * other real time and normal priority task
    */
   param.sched_priority = 16;
   for (i = 0; i < priv->num_crtcs; i++) {
     /* initialize display thread */
     priv->disp_thread[i].crtc_id = priv->crtcs[i]->base.id;
     kthread_init_worker(&priv->disp_thread[i].worker);
     priv->disp_thread[i].dev = ddev;
     priv->disp_thread[i].thread = kthread_run(kthread_worker_fn, &priv->disp_thread[i].worker, "crtc_commit:%d", priv->disp_thread[i].crtc_id);
     ret = sched_setscheduler(priv->disp_thread[i].thread, SCHED_FIFO, &param);
     if (ret) pr_warn("display thread priority update failed: %d\n", ret);
     if (IS_ERR(priv->disp_thread[i].thread)) {
       dev_err(dev, "failed to create crtc_commit kthread\n");
       priv->disp_thread[i].thread = NULL;
     }
     /* initialize event thread */
     priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
     kthread_init_worker(&priv->event_thread[i].worker);
     priv->event_thread[i].dev = ddev;
     priv->event_thread[i].thread = kthread_run(kthread_worker_fn, &priv->event_thread[i].worker, "crtc_event:%d", priv->event_thread[i].crtc_id);
     /**
      * event thread should also run at same priority as disp_thread
      * because it is handling frame_done events. A lower priority
      * event thread and higher priority disp_thread can causes
      * frame_pending counters beyond 2. This can lead to commit
      * failure at crtc commit level.
      */
     ret = sched_setscheduler(priv->event_thread[i].thread, SCHED_FIFO, &param);
     if (ret) pr_warn("display event thread priority update failed: %d\n", ret);
     if (IS_ERR(priv->event_thread[i].thread)) {
       dev_err(dev, "failed to create crtc_event kthread\n");
       priv->event_thread[i].thread = NULL;
     }
     if ((!priv->disp_thread[i].thread) || !priv->event_thread[i].thread) {
       /* clean up previously created threads if any */
       for (; i >= 0; i--) {
         if (priv->disp_thread[i].thread) {
           kthread_stop(priv->disp_thread[i].thread);
           priv->disp_thread[i].thread = NULL;
         }
         if (priv->event_thread[i].thread) {
           kthread_stop(priv->event_thread[i].thread);
           priv->event_thread[i].thread = NULL;
         }
       }
       goto err_msm_uninit;
     }
   }
   ret = drm_vblank_init(ddev, priv->num_crtcs);
   if (ret < 0) {
     dev_err(dev, "failed to initialize vblank\n");
     goto err_msm_uninit;
   }
   if (kms) {
     pm_runtime_get_sync(dev);
     ret = drm_irq_install(ddev, kms->irq);
     pm_runtime_put_sync(dev);
     if (ret < 0) {
       dev_err(dev, "failed to install IRQ handler\n");
       goto err_msm_uninit;
     }
   }
   ret = drm_dev_register(ddev, 0);
   if (ret) goto err_msm_uninit;
   drm_mode_config_reset(ddev);
 #ifdef CONFIG_DRM_FBDEV_EMULATION
   if (fbdev) priv->fbdev = msm_fbdev_init(ddev);
 #endif
   ret = msm_debugfs_late_init(ddev);
   if (ret) goto err_msm_uninit;
   drm_kms_helper_poll_init(ddev);
   return 0;
 err_msm_uninit:
   msm_drm_uninit(dev);
   return ret;
 err_destroy_mdss:
   if (mdss && mdss->funcs) mdss->funcs->destroy(ddev);
 err_free_priv:
   kfree(priv);
 err_unref_drm_dev:
-  drm_dev_unref(ddev);
+  drm_dev_put(ddev);
   return ret;
 }<sep>@@
expression ddev;
@@
-       drm_dev_unref(ddev);
+       drm_dev_put(ddev);