[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e7a2db20-4d6c-4fd0-ba0e-d8a2057cfbfc@linaro.org>
Date: Wed, 29 Nov 2023 10:27:11 +0100
From: neil.armstrong@...aro.org
To: Haoran Liu <liuhaoran14@....com>, maarten.lankhorst@...ux.intel.com
Cc: mripard@...nel.org, tzimmermann@...e.de, airlied@...il.com,
daniel@...ll.ch, khilman@...libre.com, jbrunet@...libre.com,
martin.blumenstingl@...glemail.com,
dri-devel@...ts.freedesktop.org, linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [drm/meson] meson_plane: Add error handling
Hi,
Thanks for your patch!
On 29/11/2023 10:21, Haoran Liu wrote:
> 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 <liuhaoran14@....com>
> ---
> drivers/gpu/drm/meson/meson_plane.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 815dfe30492b..67b36398f146 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -534,6 +534,7 @@ int meson_plane_create(struct meson_drm *priv)
> struct meson_plane *meson_plane;
> struct drm_plane *plane;
> const uint64_t *format_modifiers = format_modifiers_default;
> + int ret;
>
> meson_plane = devm_kzalloc(priv->drm->dev, sizeof(*meson_plane),
> GFP_KERNEL);
> @@ -548,12 +549,16 @@ int meson_plane_create(struct meson_drm *priv)
> else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A))
> format_modifiers = format_modifiers_afbc_g12a;
>
> - drm_universal_plane_init(priv->drm, plane, 0xFF,
> + ret = drm_universal_plane_init(priv->drm, plane, 0xFF,
> &meson_plane_funcs,
> supported_drm_formats,
> ARRAY_SIZE(supported_drm_formats),
> format_modifiers,
> DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane");
Could you re-align those lines aswell ?
> + if (ret) {
> + devm_kfree(priv->drm->dev, meson_plane);
> + return ret;
> + }
>
> drm_plane_helper_add(plane, &meson_plane_helper_funcs);
>
Thanks,
Neil
Powered by blists - more mailing lists