In a lots of places in DPU driver memory is allocated by using the kzalloc and then manually freed using kfree. However thes memory chunks have a well-defined life cycle. They are either a part of the driver's runtime and can be devm_kzalloc'ed or are exposed to userspace via the DRM objects and thus can be drmm_alloc'ed. Implement corresponding runtime resource manangement for the DPU driver. Changes since v3: - Rebased on top of msm-next Changes since v2: - Added missing dependencies to the cover letter (Jessica) - Fixed commit message for patch 4 (Jessica) Changes since v1: - Fix error handling for some of drmm_foo_alloc() functions, which return error pointer in case of an error rather than typical NULL. Dmitry Baryshkov (13): drm/msm/dpu: cleanup dpu_kms_hw_init error path drm/msm/dpu: remove IS_ERR_OR_NULL for dpu_hw_intr_init() error handling drm/msm/dpu: use devres-managed allocation for interrupts data drm/msm/dpu: use devres-managed allocation for VBIF data drm/msm/dpu: use devres-managed allocation for MDP TOP drm/msm/dpu: use devres-managed allocation for HW blocks drm/msm/dpu: drop unused dpu_plane::lock drm/msm/dpu: remove QoS teardown on plane destruction drm/msm/dpu: use drmm-managed allocation for dpu_plane drm/msm/dpu: use drmm-managed allocation for dpu_crtc drm/msm/dpu: use drmm-managed allocation for dpu_encoder_phys drm/msm/dpu: drop dpu_encoder_phys_ops::destroy drm/msm/dpu: use drmm-managed allocation for dpu_encoder_virt drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 25 ++---- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 77 ++++------------ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 10 +-- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 15 +--- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 13 +-- .../drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 21 +---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 19 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h | 16 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 12 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h | 10 ++- .../gpu/drm/msm/disp/dpu1/dpu_hw_dsc_1_2.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 16 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.h | 12 +-- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 14 ++- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 11 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 16 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 13 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 14 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h | 12 +-- .../gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c | 14 ++- .../gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h | 13 +-- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 15 ++-- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 14 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 17 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 16 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 17 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h | 8 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c | 14 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h | 8 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 15 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h | 13 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 55 ++++-------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 59 +++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 90 +++---------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 11 +-- 36 files changed, 226 insertions(+), 487 deletions(-) -- 2.39.2