Ensure HDMI connector initialization fails when the presence of
HDMI_COLORSPACE_YUV420 in the given supported_formats bitmask doesn't
match the value of drm_connector->ycbcr_420_allowed.

Suggested-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocal...@collabora.com>
---
 drivers/gpu/drm/drm_connector.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 
ae6e71305f3000aff1cfe96b050061a300b9478e..46295176f39f91d69eaad716bb9315002f38e633
 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -590,6 +590,9 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
        if (!supported_formats || !(supported_formats & 
BIT(HDMI_COLORSPACE_RGB)))
                return -EINVAL;
 
+       if (connector->ycbcr_420_allowed != !!(supported_formats & 
BIT(HDMI_COLORSPACE_YUV420)))
+               return -EINVAL;
+
        if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
                return -EINVAL;
 

-- 
2.47.0

Reply via email to