drm/imx: dpu: plane: Improve bailout path of dpu_plane_create()

This patch improves bailout path of dpu_plane_create().
As we'll add more drm properties to the planes later,
this would simply the code.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
This commit is contained in:
Liu Ying
2019-11-14 10:42:30 +08:00
committed by Dong Aisheng
parent 62c56f1c25
commit 97398695df

View File

@ -970,17 +970,15 @@ struct dpu_plane *dpu_plane_create(struct drm_device *drm,
format_count = ARRAY_SIZE(dpu_overlay_formats);
break;
default:
kfree(dpu_plane);
return ERR_PTR(-EINVAL);
ret = -EINVAL;
goto err;
}
ret = drm_universal_plane_init(drm, plane, possible_crtcs,
&dpu_plane_funcs, formats, format_count,
dpu_format_modifiers, type, NULL);
if (ret) {
kfree(dpu_plane);
return ERR_PTR(ret);
}
if (ret)
goto err;
drm_plane_helper_add(plane, &dpu_plane_helper_funcs);
@ -998,10 +996,12 @@ struct dpu_plane *dpu_plane_create(struct drm_device *drm,
ret = -EINVAL;
}
if (ret) {
kfree(dpu_plane);
return ERR_PTR(ret);
}
if (ret)
goto err;
return dpu_plane;
err:
kfree(dpu_plane);
return ERR_PTR(ret);
}