[Freedreno] [PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init()
Dmitry Baryshkov
dmitry.baryshkov at linaro.org
Sun Sep 24 09:33:46 UTC 2023
On Sun, 24 Sept 2023 at 09:42, liuhaoran <liuhaoran14 at 163.com> wrote:
>
> This patch adds error-handling for the drm_connector_init() and
> drm_connector_attach_encoder inside the mdp4_lvds_connector_init().
>
> Signed-off-by: liuhaoran <liuhaoran14 at 163.com>
As pointed out by the kernel robot, this was not even compile tested.
So NAK. Please use proper casts for error returns.
> ---
> .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> index 7444b75c4215..62eb363ba90f 100644
> --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> @@ -96,6 +96,7 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
> {
> struct drm_connector *connector = NULL;
> struct mdp4_lvds_connector *mdp4_lvds_connector;
> + int ret;
>
> mdp4_lvds_connector = kzalloc(sizeof(*mdp4_lvds_connector), GFP_KERNEL);
> if (!mdp4_lvds_connector)
> @@ -106,8 +107,12 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
>
> connector = &mdp4_lvds_connector->base;
>
> - drm_connector_init(dev, connector, &mdp4_lvds_connector_funcs,
> - DRM_MODE_CONNECTOR_LVDS);
> + ret = drm_connector_init(dev, connector, &mdp4_lvds_connector_funcs,
> + DRM_MODE_CONNECTOR_LVDS);
> +
> + if (ret)
> + return ret;
> +
> drm_connector_helper_add(connector, &mdp4_lvds_connector_helper_funcs);
>
> connector->polled = 0;
> @@ -115,7 +120,10 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
> connector->interlace_allowed = 0;
> connector->doublescan_allowed = 0;
>
> - drm_connector_attach_encoder(connector, encoder);
> + ret = drm_connector_attach_encoder(connector, encoder);
> +
> + if (ret)
> + return ret;
>
> return connector;
> }
> --
> 2.17.1
>
--
With best wishes
Dmitry
More information about the Freedreno
mailing list