[PATCH] i2c: Add error handling for drm_hdmi_avi_infoframe_from_display_mode in tda998x_write_avi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux