[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240804135737.62663-1-m.lobanov@rosalinux.ru>
Date: Sun, 4 Aug 2024 09:57:35 -0400
From: Mikhail Lobanov <m.lobanov@...alinux.ru>
To: Russell King <linux@...linux.org.uk>
Cc: Mikhail Lobanov <m.lobanov@...alinux.ru>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Jani Nikula <jani.nikula@...el.com>,
Thierry Reding <treding@...dia.com>,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: [PATCH] i2c: Add error handling for drm_hdmi_avi_infoframe_from_display_mode in tda998x_write_avi
This patch adds error handling for the return value of the drm_hdmi_avi_infoframe_from_display_mode function
within the tda998x_write_avi function. The function's return value is checked to ensure that any errors
encountered during the generation of the AVI infoframe are properly handled. If the function fails, an error
message is logged and the function exits early to avoid further operations with invalid data.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 13d0add333af ("drm/edid: Pass connector to AVI infoframe functions")
Signed-off-by: Mikhail Lobanov <m.lobanov@...alinux.ru>
---
drivers/gpu/drm/i2c/tda998x_drv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index d8d7de18dd65..6d8b3654d9a9 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -860,8 +860,13 @@ tda998x_write_avi(struct tda998x_priv *priv, const struct drm_display_mode *mode
{
union hdmi_infoframe frame;
- drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
&priv->connector, mode);
+ if (err < 0) {
+ dev_err(&priv->connector.dev, "failed to get AVI infoframe: %d\n", err);
+ return;
+ }
+
frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
drm_hdmi_avi_infoframe_quant_range(&frame.avi, &priv->connector, mode,
priv->rgb_quant_range);
--
2.43.0
Powered by blists - more mailing lists