[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200425144943.GE32235@ravnborg.org>
Date: Sat, 25 Apr 2020 16:49:43 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Enric Balletbo i Serra <enric.balletbo@...labora.com>
Cc: linux-kernel@...r.kernel.org,
Jernej Skrabec <jernej.skrabec@...l.net>,
Jonas Karlman <jonas@...boo.se>,
David Airlie <airlied@...ux.ie>,
Neil Armstrong <narmstrong@...libre.com>,
dri-devel@...ts.freedesktop.org,
Andrzej Hajda <a.hajda@...sung.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Collabora Kernel ML <kernel@...labora.com>
Subject: Re: [PATCH] drm/bridge: panel: Return always an error pointer in
drm_panel_bridge_add()
On Thu, Apr 16, 2020 at 11:06:54PM +0200, Enric Balletbo i Serra wrote:
> Since commit 89958b7cd955 ("drm/bridge: panel: Infer connector type from
> panel by default"), drm_panel_bridge_add() and their variants can return
> NULL and an error pointer. This is fine but none of the actual users of
> the API are checking for the NULL value. Instead of change all the
> users, seems reasonable to return an error pointer instead. So change
> the returned value for those functions when the connector type is unknown.
>
> Suggested-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
Thanks, added to drm-misc-next.
Sam
> ---
>
> drivers/gpu/drm/bridge/panel.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index 8461ee8304ba..7a3df0f319f3 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -166,7 +166,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
> *
> * The connector type is set to @panel->connector_type, which must be set to a
> * known type. Calling this function with a panel whose connector type is
> - * DRM_MODE_CONNECTOR_Unknown will return NULL.
> + * DRM_MODE_CONNECTOR_Unknown will return ERR_PTR(-EINVAL).
> *
> * See devm_drm_panel_bridge_add() for an automatically managed version of this
> * function.
> @@ -174,7 +174,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
> struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel)
> {
> if (WARN_ON(panel->connector_type == DRM_MODE_CONNECTOR_Unknown))
> - return NULL;
> + return ERR_PTR(-EINVAL);
>
> return drm_panel_bridge_add_typed(panel, panel->connector_type);
> }
> @@ -265,7 +265,7 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
> struct drm_panel *panel)
> {
> if (WARN_ON(panel->connector_type == DRM_MODE_CONNECTOR_Unknown))
> - return NULL;
> + return ERR_PTR(-EINVAL);
>
> return devm_drm_panel_bridge_add_typed(dev, panel,
> panel->connector_type);
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists