rockchip/vcodec: drop needless devm_clk_put
authorHuang, Tao <huangtao@rock-chips.com>
Fri, 2 Dec 2016 08:18:33 +0000 (16:18 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 2 Dec 2016 11:38:33 +0000 (19:38 +0800)
Also make sure clk is NULL if get failed.

Change-Id: I102175a108c6e7a91948d82cce97c1a1d88a071e
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
drivers/video/rockchip/vcodec/vcodec_service.c

index a1e09b9..b91669f 100644 (file)
@@ -568,6 +568,7 @@ static int vpu_get_clk(struct vpu_service_info *pservice)
                pservice->pd_video = devm_clk_get(dev, "pd_hevc");
                if (IS_ERR(pservice->pd_video)) {
                        dev_err(dev, "failed on clk_get pd_hevc\n");
+                       pservice->pd_video = NULL;
                        return -1;
                }
        case VCODEC_DEVICE_ID_COMBO:
@@ -580,18 +581,21 @@ static int vpu_get_clk(struct vpu_service_info *pservice)
                pservice->clk_core = devm_clk_get(dev, "clk_core");
                if (IS_ERR(pservice->clk_core)) {
                        dev_err(dev, "failed on clk_get clk_core\n");
+                       pservice->clk_core = NULL;
                        return -1;
                }
        case VCODEC_DEVICE_ID_VPU:
                pservice->aclk_vcodec = devm_clk_get(dev, "aclk_vcodec");
                if (IS_ERR(pservice->aclk_vcodec)) {
                        dev_err(dev, "failed on clk_get aclk_vcodec\n");
+                       pservice->aclk_vcodec = NULL;
                        return -1;
                }
 
                pservice->hclk_vcodec = devm_clk_get(dev, "hclk_vcodec");
                if (IS_ERR(pservice->hclk_vcodec)) {
                        dev_err(dev, "failed on clk_get hclk_vcodec\n");
+                       pservice->hclk_vcodec = NULL;
                        return -1;
                }
                if (pservice->pd_video == NULL) {
@@ -612,22 +616,6 @@ static int vpu_get_clk(struct vpu_service_info *pservice)
 #endif
 }
 
-static void vpu_put_clk(struct vpu_service_info *pservice)
-{
-#if VCODEC_CLOCK_ENABLE
-       if (pservice->pd_video)
-               devm_clk_put(pservice->dev, pservice->pd_video);
-       if (pservice->aclk_vcodec)
-               devm_clk_put(pservice->dev, pservice->aclk_vcodec);
-       if (pservice->hclk_vcodec)
-               devm_clk_put(pservice->dev, pservice->hclk_vcodec);
-       if (pservice->clk_core)
-               devm_clk_put(pservice->dev, pservice->clk_core);
-       if (pservice->clk_cabac)
-               devm_clk_put(pservice->dev, pservice->clk_cabac);
-#endif
-}
-
 static void vpu_reset(struct vpu_subdev_data *data)
 {
        struct vpu_service_info *pservice = data->pservice;
@@ -2580,7 +2568,6 @@ static int vcodec_probe(struct platform_device *pdev)
 err:
        pr_info("init failed\n");
        vpu_service_power_off(pservice);
-       vpu_put_clk(pservice);
        wake_lock_destroy(&pservice->wake_lock);
 
        return ret;