mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities
[ Upstream commitcfc146137a] 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:f70ac097a2("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-2-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0c323430e4
commit
b625a6eaf2
@@ -1588,7 +1588,9 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp)
|
|||||||
u8 val;
|
u8 val;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap);
|
ret = drm_dp_read_dpcd_caps(&mtk_dp->aux, mtk_dp->rx_cap);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (drm_dp_tps4_supported(mtk_dp->rx_cap))
|
if (drm_dp_tps4_supported(mtk_dp->rx_cap))
|
||||||
mtk_dp->train_info.channel_eq_pattern = DP_TRAINING_PATTERN_4;
|
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)
|
|||||||
return ret == 0 ? -EIO : ret;
|
return ret == 0 ? -EIO : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val)
|
if (val) {
|
||||||
drm_dp_dpcd_writeb(&mtk_dp->aux,
|
ret = drm_dp_dpcd_writeb(&mtk_dp->aux,
|
||||||
DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0,
|
DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0,
|
||||||
val);
|
val);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user