Skip to content

Commit cfc1461

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities
If reading the RX capabilities fails the training pattern will be set wrongly: add error checking for drm_dp_read_dpcd_caps() and return if anything went wrong with it. While at it, also add a less critical error check when writing to clear the ESI0 IRQ vector. Fixes: f70ac09 ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Tested-by: Chen-Yu Tsai <[email protected]> Reviewed-by: Alexandre Mergnat <[email protected]> Reviewed-by: CK Hu <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 61d9afa commit cfc1461

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/gpu/drm/mediatek/mtk_dp.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,9 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp)
15881588
u8 val;
15891589
ssize_t ret;
15901590

1591-
drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap);
1591+
ret = drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap);
1592+
if (ret < 0)
1593+
return ret;
15921594

15931595
if (drm_dp_tps4_supported(mtk_dp->rx_cap))
15941596
mtk_dp->train_info.channel_eq_pattern = DP_TRAINING_PATTERN_4;
@@ -1615,10 +1617,13 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp)
16151617
return ret == 0 ? -EIO : ret;
16161618
}
16171619

1618-
if (val)
1619-
drm_dp_dpcd_writeb(&mtk_dp->aux,
1620-
DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0,
1621-
val);
1620+
if (val) {
1621+
ret = drm_dp_dpcd_writeb(&mtk_dp->aux,
1622+
DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0,
1623+
val);
1624+
if (ret < 0)
1625+
return ret;
1626+
}
16221627
}
16231628

16241629
return 0;

0 commit comments

Comments
 (0)