Commit 531d5313 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

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

Use devm_kzalloc to create SMP data structure. This allows us
to remove corresponding kfree and drop mdp5_smp_destroy() function.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/546172/
Link: https://lore.kernel.org/r/20230708010407.3871346-7-dmitry.baryshkov@linaro.org
parent 323e9a18
...@@ -618,9 +618,6 @@ static void mdp5_destroy(struct mdp5_kms *mdp5_kms) ...@@ -618,9 +618,6 @@ static void mdp5_destroy(struct mdp5_kms *mdp5_kms)
{ {
int i; int i;
if (mdp5_kms->smp)
mdp5_smp_destroy(mdp5_kms->smp);
for (i = 0; i < mdp5_kms->num_intfs; i++) for (i = 0; i < mdp5_kms->num_intfs; i++)
kfree(mdp5_kms->intfs[i]); kfree(mdp5_kms->intfs[i]);
......
...@@ -370,23 +370,17 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p) ...@@ -370,23 +370,17 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p)
drm_modeset_unlock(&mdp5_kms->glob_state_lock); drm_modeset_unlock(&mdp5_kms->glob_state_lock);
} }
void mdp5_smp_destroy(struct mdp5_smp *smp)
{
kfree(smp);
}
struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_block *cfg) struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_block *cfg)
{ {
struct drm_device *dev = mdp5_kms->dev;
struct mdp5_smp_state *state; struct mdp5_smp_state *state;
struct mdp5_global_state *global_state; struct mdp5_global_state *global_state;
struct mdp5_smp *smp; struct mdp5_smp *smp;
int ret;
smp = kzalloc(sizeof(*smp), GFP_KERNEL); smp = devm_kzalloc(dev->dev, sizeof(*smp), GFP_KERNEL);
if (unlikely(!smp)) { if (unlikely(!smp))
ret = -ENOMEM; return ERR_PTR(-ENOMEM);
goto fail;
}
smp->dev = mdp5_kms->dev; smp->dev = mdp5_kms->dev;
smp->blk_cnt = cfg->mmb_count; smp->blk_cnt = cfg->mmb_count;
...@@ -400,9 +394,4 @@ struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_ ...@@ -400,9 +394,4 @@ struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_
memcpy(smp->reserved, cfg->reserved, sizeof(smp->reserved)); memcpy(smp->reserved, cfg->reserved, sizeof(smp->reserved));
return smp; return smp;
fail:
if (smp)
mdp5_smp_destroy(smp);
return ERR_PTR(ret);
} }
...@@ -68,7 +68,6 @@ struct mdp5_smp; ...@@ -68,7 +68,6 @@ struct mdp5_smp;
struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms,
const struct mdp5_smp_block *cfg); const struct mdp5_smp_block *cfg);
void mdp5_smp_destroy(struct mdp5_smp *smp);
void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p); void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment