Skip to content

Commit 68957f5

Browse files
Haoran Liugregkh
authored andcommitted
drm/meson: plane: Add error handling
[ Upstream commit 3c28b23 ] This patch adds robust error handling to the meson_plane_create function in drivers/gpu/drm/meson/meson_plane.c. The function previously lacked proper handling for potential failure scenarios of the drm_universal_plane_init call. Signed-off-by: Haoran Liu <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] [narmstrong: fixe the commit subject] Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent ae9018e commit 68957f5

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/gpu/drm/meson/meson_plane.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ int meson_plane_create(struct meson_drm *priv)
534534
struct meson_plane *meson_plane;
535535
struct drm_plane *plane;
536536
const uint64_t *format_modifiers = format_modifiers_default;
537+
int ret;
537538

538539
meson_plane = devm_kzalloc(priv->drm->dev, sizeof(*meson_plane),
539540
GFP_KERNEL);
@@ -548,12 +549,16 @@ int meson_plane_create(struct meson_drm *priv)
548549
else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A))
549550
format_modifiers = format_modifiers_afbc_g12a;
550551

551-
drm_universal_plane_init(priv->drm, plane, 0xFF,
552-
&meson_plane_funcs,
553-
supported_drm_formats,
554-
ARRAY_SIZE(supported_drm_formats),
555-
format_modifiers,
556-
DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane");
552+
ret = drm_universal_plane_init(priv->drm, plane, 0xFF,
553+
&meson_plane_funcs,
554+
supported_drm_formats,
555+
ARRAY_SIZE(supported_drm_formats),
556+
format_modifiers,
557+
DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane");
558+
if (ret) {
559+
devm_kfree(priv->drm->dev, meson_plane);
560+
return ret;
561+
}
557562

558563
drm_plane_helper_add(plane, &meson_plane_helper_funcs);
559564

0 commit comments

Comments
 (0)