Skip to contentSkip to conversation

drm/bridge: anx7625: Don't store unread return value

PATCH In review Robert Foss 2 participants 3 messages Aug 16, 2021 – Aug 18, 2021

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

PATCH 1/1 drm/bridge: anx7625: Don't store unread return value

The return value of sp_tx_rst_aux() is stored, but never read. This happens in the context EDID communication already failing, which means that this additional failure doesn't necessarily convey any additional inforamation.

This means that we can safely avoid storing the value.

Fixes 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP")
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -1
index 14d73fb1dd15b..3471785915c45 100644
@@ -771,7 +771,7 @@ static int segments_edid_read(struct anx7625_data *ctx,
 		ret = sp_tx_aux_rd(ctx, 0xf1);
 
 		if (ret) {
-			ret = sp_tx_rst_aux(ctx);
+			sp_tx_rst_aux(ctx);
 			DRM_DEV_ERROR(dev, "segment read fail, reset!\n");
 		} else {
 			ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
Signature · 1 line
2.30.2
#1 lore raw

Hi Robert,

Quoted 20 lines · Robert Foss

The return value of sp_tx_rst_aux() is stored, but never read. This happens in the context EDID communication already failing, which means that this additional failure doesn't necessarily convey any additional inforamation.

This means that we can safely avoid storing the value.

Fixes 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP")
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 14d73fb1dd15b..3471785915c45 100644

drivers/gpu/drm/bridge/analogix/anx7625.c static int segments_edid_read(struct anx7625_data *ctx, · line 777

Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -1
@@ -771,7 +771,7 @@ static int segments_edid_read(struct anx7625_data *ctx,
 		ret = sp_tx_aux_rd(ctx, 0xf1);
 
 		if (ret) {
-			ret = sp_tx_rst_aux(ctx);
+			sp_tx_rst_aux(ctx);
 			DRM_DEV_ERROR(dev, "segment read fail, reset!\n");
 		} else {
 			ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,

From a quick look this seems to be the wrong fix.
Replace return 0; with return ret; as the last line in this function looks like the correct fix to me.
With a careful audit that the error handling is OK in said function.

Sam

#2 lore raw

Hey Sam,

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
index 14d73fb1dd15b..3471785915c45 100644
@@ -771,7 +771,7 @@ static int segments_edid_read(struct anx7625_data *ctx,
              ret = sp_tx_aux_rd(ctx, 0xf1);
 
Quoted 11 lines

drivers/gpu/drm/bridge/analogix/anx7625.c static int segments_edid_read(struct anx7625_data *ctx, · line 777

Quoted 6 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -1
              if (ret) {
-                     ret = sp_tx_rst_aux(ctx);
+                     sp_tx_rst_aux(ctx);
                      DRM_DEV_ERROR(dev, "segment read fail, reset!\n");
              } else {
                      ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,

From a quick look this seems to be the wrong fix.
Replace return 0; with return ret; as the last line in this function looks like the correct fix to me.
With a careful audit that the error handling is OK in said function.

Thanks for the suggestion, let me have a second look at it.

Quoted 2 lines

Sam