Re: [PATCH v4 5/5] drm/msm/dpu: move VBIF blocks handling to dpu_rm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/01/2022 04:27, Stephen Boyd wrote:
Quoting Dmitry Baryshkov (2022-01-05 15:10:31)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index bf4d72356a12..2301ac114920 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -78,6 +78,10 @@ int dpu_rm_destroy(struct dpu_rm *rm)
                 if (rm->hw_intf[i])
                         dpu_hw_intf_destroy(rm->hw_intf[i]);
         }
+       for (i = 0; i < ARRAY_SIZE(rm->hw_vbif); i++) {
+               if (rm->hw_vbif[i])
+                       dpu_hw_vbif_destroy(rm->hw_vbif[i]);

Maybe drop this check and pass NULL to dpu_hw_vbif_destroy() sometimes?
Then the check can be omitted and the braces dropped

Nice idea. This also applies to dpu_hw_intf_destroy, so I'm going to apply it to the previous patch.


+       }

         return 0;
  }
@@ -212,6 +216,23 @@ int dpu_rm_init(struct dpu_rm *rm,
                 rm->dspp_blks[dspp->id - DSPP_0] = &hw->base;
         }

+       for (i = 0; i < cat->vbif_count; i++) {
+               struct dpu_hw_vbif *hw;
+               const struct dpu_vbif_cfg *vbif = &cat->vbif[i];
+
+               if (vbif->id < VBIF_0 || vbif->id >= VBIF_MAX) {
+                       DPU_ERROR("skip vbif %d with invalid id\n", vbif->id);
+                       continue;
+               }
+               hw = dpu_hw_vbif_init(vbif->id, mmio, cat);
+               if (IS_ERR_OR_NULL(hw)) {
+                       rc = PTR_ERR(hw);
+                       DPU_ERROR("failed vbif object creation: err %d\n", rc);
+                       goto fail;

If it's NULL then rc will be 0 and fail will return 0. Is that
intentional?

Actually no. And init functions can not return NULL. So let's fix it too.


+               }
+               rm->hw_vbif[vbif->id - VBIF_0] = hw;
+       }
+
         return 0;

  fail:


--
With best wishes
Dmitry



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux