Skip to content

Commit 5229081

Browse files
yangliankun1Chun-Kuang Hu
authored andcommitted
drm/mediatek: Add return value check when reading DPCD
Check the return value of drm_dp_dpcd_readb() to confirm that AUX communication is successful. To simplify the code, replace drm_dp_dpcd_readb() and DP_GET_SINK_COUNT() with drm_dp_read_sink_count(). Fixes: f70ac09 ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Signed-off-by: Liankun Yang <liankun.yang@mediatek.com> Reviewed-by: Guillaume Ranquet <granquet@baylibre.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20241218113448.2992-1-liankun.yang@mediatek.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent c4bd13b commit 5229081

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/gpu/drm/mediatek/mtk_dp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,7 +2103,6 @@ static enum drm_connector_status mtk_dp_bdg_detect(struct drm_bridge *bridge)
21032103
struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge);
21042104
enum drm_connector_status ret = connector_status_disconnected;
21052105
bool enabled = mtk_dp->enabled;
2106-
u8 sink_count = 0;
21072106

21082107
if (!mtk_dp->train_info.cable_plugged_in)
21092108
return ret;
@@ -2118,8 +2117,8 @@ static enum drm_connector_status mtk_dp_bdg_detect(struct drm_bridge *bridge)
21182117
* function, we just need to check the HPD connection to check
21192118
* whether we connect to a sink device.
21202119
*/
2121-
drm_dp_dpcd_readb(&mtk_dp->aux, DP_SINK_COUNT, &sink_count);
2122-
if (DP_GET_SINK_COUNT(sink_count))
2120+
2121+
if (drm_dp_read_sink_count(&mtk_dp->aux) > 0)
21232122
ret = connector_status_connected;
21242123

21252124
if (!enabled)

0 commit comments

Comments
 (0)