Skip to contentSkip to conversation

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

PATCH Applied Marek Vasut 3 participants 3 messages Aug 1, 2022 – Aug 29, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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")
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
 drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/lvds-codec.c +1 -1
index 702ea803a743c..39e7004de7200 100644
@@ -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 {
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Marek Vasut

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")
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
  drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/lvds-codec.c +0 -0
index 702ea803a743c..39e7004de7200 100644

drivers/gpu/drm/bridge/lvds-codec.c static int lvds_codec_probe(struct platform_device *pdev) · line 186

Quoted 8 lines
drivers/gpu/drm/bridge/lvds-codec.c +1 -1
@@ -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 {
Applied
#2 lore raw
Quoted 16 lines · Neil Armstrong
Quoted 14 lines · Marek Vasut

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")
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
  drivers/gpu/drm/bridge/lvds-codec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/bridge/lvds-codec.c static int lvds_codec_probe(struct platform_device *pdev) · line 186

Quoted 13 lines
drivers/gpu/drm/bridge/lvds-codec.c +1 -1
index 702ea803a743c..39e7004de7200 100644
@@ -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 {

Applied to drm-misc-next.