dec_clk->clk_info = devm_kcalloc(&pdev->dev,
                        dec_clk->clk_num, sizeof(*clk_info),
                        GFP_KERNEL);
-               if (!dec_clk->clk_info)
-                       return -ENOMEM;
+               if (!dec_clk->clk_info) {
+                       ret = -ENOMEM;
+                       goto put_device;
+               }
        } else {
                mtk_v4l2_err("Failed to get vdec clock count");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto put_device;
        }
 
        for (i = 0; i < dec_clk->clk_num; i++) {
                        "clock-names", i, &clk_info->clk_name);
                if (ret) {
                        mtk_v4l2_err("Failed to get clock name id = %d", i);
-                       return ret;
+                       goto put_device;
                }
                clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
                        clk_info->clk_name);
                if (IS_ERR(clk_info->vcodec_clk)) {
                        mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
                                clk_info->clk_name);
-                       return PTR_ERR(clk_info->vcodec_clk);
+                       ret = PTR_ERR(clk_info->vcodec_clk);
+                       goto put_device;
                }
        }
 
        pm_runtime_enable(&pdev->dev);
-
+       return 0;
+put_device:
+       put_device(pm->larbvdec);
        return ret;
 }