diff mbox series

drm/bridge: lvds-codec: Fix error checking of drm_of_lvds_get_data_mapping()

Message ID 20220801125419.167562-1-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series drm/bridge: lvds-codec: Fix error checking of drm_of_lvds_get_data_mapping() | expand

Commit Message

Marek Vasut Aug. 1, 2022, 12:54 p.m. UTC
The drm_of_lvds_get_data_mapping() returns either negative value on
error or MEDIA_BUS_FMT_* otherwise. The check for 'ret' would also
catch the positive case of MEDIA_BUS_FMT_* and lead to probe failure
every time 'data-mapping' DT property is specified.

Fixes: 7c4dd0a266527 ("drm: of: Add drm_of_lvds_get_data_mapping")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Neil Armstrong Aug. 10, 2022, 9:27 a.m. UTC | #1
On 01/08/2022 14:54, Marek Vasut wrote:
> The drm_of_lvds_get_data_mapping() returns either negative value on
> error or MEDIA_BUS_FMT_* otherwise. The check for 'ret' would also
> catch the positive case of MEDIA_BUS_FMT_* and lead to probe failure
> every time 'data-mapping' DT property is specified.
> 
> Fixes: 7c4dd0a266527 ("drm: of: Add drm_of_lvds_get_data_mapping")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> To: dri-devel@lists.freedesktop.org
> ---
>   drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
> index 702ea803a743c..39e7004de7200 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -180,7 +180,7 @@ static int lvds_codec_probe(struct platform_device *pdev)
>   		of_node_put(bus_node);
>   		if (ret == -ENODEV) {
>   			dev_warn(dev, "missing 'data-mapping' DT property\n");
> -		} else if (ret) {
> +		} else if (ret < 0) {
>   			dev_err(dev, "invalid 'data-mapping' DT property\n");
>   			return ret;
>   		} else {

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Robert Foss Aug. 29, 2022, 3:32 p.m. UTC | #2
On Wed, 10 Aug 2022 at 11:27, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> On 01/08/2022 14:54, Marek Vasut wrote:
> > The drm_of_lvds_get_data_mapping() returns either negative value on
> > error or MEDIA_BUS_FMT_* otherwise. The check for 'ret' would also
> > catch the positive case of MEDIA_BUS_FMT_* and lead to probe failure
> > every time 'data-mapping' DT property is specified.
> >
> > Fixes: 7c4dd0a266527 ("drm: of: Add drm_of_lvds_get_data_mapping")
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > To: dri-devel@lists.freedesktop.org
> > ---
> >   drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
> > index 702ea803a743c..39e7004de7200 100644
> > --- a/drivers/gpu/drm/bridge/lvds-codec.c
> > +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> > @@ -180,7 +180,7 @@ static int lvds_codec_probe(struct platform_device *pdev)
> >               of_node_put(bus_node);
> >               if (ret == -ENODEV) {
> >                       dev_warn(dev, "missing 'data-mapping' DT property\n");
> > -             } else if (ret) {
> > +             } else if (ret < 0) {
> >                       dev_err(dev, "invalid 'data-mapping' DT property\n");
> >                       return ret;
> >               } else {
>
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Applied to drm-misc-next.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
index 702ea803a743c..39e7004de7200 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -180,7 +180,7 @@  static int lvds_codec_probe(struct platform_device *pdev)
 		of_node_put(bus_node);
 		if (ret == -ENODEV) {
 			dev_warn(dev, "missing 'data-mapping' DT property\n");
-		} else if (ret) {
+		} else if (ret < 0) {
 			dev_err(dev, "invalid 'data-mapping' DT property\n");
 			return ret;
 		} else {