Skip to contentSkip to conversation

drm/bridge: synopsys: dw-dp: fix bool function returning negative error code

PATCH In review Bob ynn 2 participants 3 messages May 13 – May 17

Subsystems (4)
lore
Share & tools
lore

Bob ynn

author
#0 lore raw

PATCH 1/1 drm/bridge: synopsys: dw-dp: fix bool function returning negative error code

From: yanlonglong <[email protected]>

The function dw_dp_video_need_vsc_sdp() is declared to return bool, but it returns -EINVAL when dw_dp_get_bridge_state() fails. Since -EINVAL is a non-zero value (-22), it is implicitly converted to true, which is the opposite of the intended behavior

Fixes 86eecc3a9c2e("drm/bridge: synopsys: Add DW DPTX Controller support library")
---
 drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-dp.c +1 -1
index 21541be094c4..7b99d91b3456 100644
@@ -1143,7 +1143,7 @@ static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
 
 	state = dw_dp_get_bridge_state(dp);
 	if (!state)
-		return -EINVAL;
+		return false;
 
 	if (!link->vsc_sdp_supported)
 		return false;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hello Bob,

Quoted 9 lines · Bob ynn

From: yanlonglong <[email protected]>

The function dw_dp_video_need_vsc_sdp() is declared to return bool, but it returns -EINVAL when dw_dp_get_bridge_state() fails. Since -EINVAL is a non-zero value (-22), it is implicitly converted to true, which is the opposite of the intended behavior

Fixes 86eecc3a9c2e("drm/bridge: synopsys: Add DW DPTX Controller support library")

Thanks

Quoted 19 lines

---
drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-dp.c +1 -1
index 21541be094c4..7b99d91b3456 100644
@@ -1143,7 +1143,7 @@ static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
 
 	state = dw_dp_get_bridge_state(dp);
 	if (!state)
-		return -EINVAL;
+		return false;
 
 	if (!link->vsc_sdp_supported)
 		return false;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Bob ynn

Hello Bob,

Quoted 10 lines · Bob ynn

From: yanlonglong <[email protected]>

The function dw_dp_video_need_vsc_sdp() is declared to return bool, but it returns -EINVAL when dw_dp_get_bridge_state() fails. Since -EINVAL is a non-zero value (-22), it is implicitly converted to true, which is the opposite of the intended behavior

Fixes 86eecc3a9c2e("drm/bridge: synopsys: Add DW DPTX Controller support library")

Thanks

Quoted 19 lines

---
drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-dp.c +1 -1
index 21541be094c4..7b99d91b3456 100644
@@ -1143,7 +1143,7 @@ static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
 
 	state = dw_dp_get_bridge_state(dp);
 	if (!state)
-		return -EINVAL;
+		return false;
 
 	if (!link->vsc_sdp_supported)
 		return false;
Signature · 1 line
2.43.0