Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/mdp5: use devres-managed allocation for pipe data

Use devm_kzalloc to create pipe data structure. This allows us
to remove corresponding kfree and drop mdp5_pipe_destroy() function.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/546171/
Link: https://lore.kernel.org/r/20230708010407.3871346-6-dmitry.baryshkov@linaro.org

+6 -14
+1 -5
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
··· 209 209 { 210 210 struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); 211 211 struct msm_gem_address_space *aspace = kms->aspace; 212 - int i; 213 - 214 - for (i = 0; i < mdp5_kms->num_hwpipes; i++) 215 - mdp5_pipe_destroy(mdp5_kms->hwpipes[i]); 216 212 217 213 if (aspace) { 218 214 aspace->mmu->funcs->detach(aspace->mmu); ··· 641 645 for (i = 0; i < cnt; i++) { 642 646 struct mdp5_hw_pipe *hwpipe; 643 647 644 - hwpipe = mdp5_pipe_init(pipes[i], offsets[i], caps); 648 + hwpipe = mdp5_pipe_init(dev, pipes[i], offsets[i], caps); 645 649 if (IS_ERR(hwpipe)) { 646 650 ret = PTR_ERR(hwpipe); 647 651 DRM_DEV_ERROR(dev->dev, "failed to construct pipe for %s (%d)\n",
+3 -7
drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c
··· 151 151 return 0; 152 152 } 153 153 154 - void mdp5_pipe_destroy(struct mdp5_hw_pipe *hwpipe) 155 - { 156 - kfree(hwpipe); 157 - } 158 - 159 - struct mdp5_hw_pipe *mdp5_pipe_init(enum mdp5_pipe pipe, 154 + struct mdp5_hw_pipe *mdp5_pipe_init(struct drm_device *dev, 155 + enum mdp5_pipe pipe, 160 156 uint32_t reg_offset, uint32_t caps) 161 157 { 162 158 struct mdp5_hw_pipe *hwpipe; 163 159 164 - hwpipe = kzalloc(sizeof(*hwpipe), GFP_KERNEL); 160 + hwpipe = devm_kzalloc(dev->dev, sizeof(*hwpipe), GFP_KERNEL); 165 161 if (!hwpipe) 166 162 return ERR_PTR(-ENOMEM); 167 163
+2 -2
drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.h
··· 39 39 struct mdp5_hw_pipe **r_hwpipe); 40 40 int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe); 41 41 42 - struct mdp5_hw_pipe *mdp5_pipe_init(enum mdp5_pipe pipe, 42 + struct mdp5_hw_pipe *mdp5_pipe_init(struct drm_device *dev, 43 + enum mdp5_pipe pipe, 43 44 uint32_t reg_offset, uint32_t caps); 44 - void mdp5_pipe_destroy(struct mdp5_hw_pipe *hwpipe); 45 45 46 46 #endif /* __MDP5_PIPE_H__ */