[PATCH v2 08/31] drm/vc4: hdmi: Warn if writing to an unknown HDMI register

Dave Stevenson dave.stevenson at raspberrypi.com
Fri Jun 21 15:20:32 UTC 2024


From: Maxime Ripard <mripard at kernel.org>

The VC4 HDMI driver has a bunch of accessors to read from a register.
The read accessor was warning when accessing an unknown register, but
the write one was just returning silently.

Let's make sure we warn also when writing to an unknown register.

Signed-off-by: Maxime Ripard <mripard at kernel.org>
Signed-off-by: Dave Stevenson <dave.stevenson at raspberrypi.com>
---
 drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
index b04b2fc8d831..68455ce513e7 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
@@ -498,8 +498,11 @@ static inline void vc4_hdmi_write(struct vc4_hdmi *hdmi,
 
 	field = &variant->registers[reg];
 	base = __vc4_hdmi_get_field_base(hdmi, field->reg);
-	if (!base)
+	if (!base) {
+		dev_warn(&hdmi->pdev->dev,
+			 "Unknown register ID %u\n", reg);
 		return;
+	}
 
 	writel(value, base + field->offset);
 }
-- 
2.34.1



More information about the dri-devel mailing list