From: Arnd Bergmann <[email protected]>

pipe_config_mismatch() takes a printf-style format string and arguments,
not a constant string, so this trigers -Wformat warnings when they are
not disabled:

drivers/gpu/drm/i915/display/intel_display.c: In function 
'pipe_config_cx0pll_mismatch':
drivers/gpu/drm/i915/display/intel_display.c:4997:9: error: format not a string 
literal and no format arguments [-Werror=format-security]
 4997 |         pipe_config_mismatch(p, fastset, crtc, name, chipname);
      |         ^~~~~~~~~~~~~~~~~~~~

drivers/gpu/drm/i915/display/intel_display.c: In function 
'pipe_config_lt_phy_pll_mismatch':
drivers/gpu/drm/i915/display/intel_display.c:5027:9: error: format not a string 
literal and no format arguments [-Werror=format-security]
 5027 |         pipe_config_mismatch(p, fastset, crtc, name, chipname);
      |         ^~~~~~~~~~~~~~~~~~~~

Use either the string literal or the trivial "%s" format so the compiler can
prove this to be used correctly.

Fixes: 45fe957ae769 ("drm/i915/display: Add compare config for MTL+ platforms")
Signed-off-by: Arnd Bergmann <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 7b4fd18c60e2..83025d5a4aa9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4987,7 +4987,7 @@ pipe_config_cx0pll_mismatch(struct drm_printer *p, bool 
fastset,
        struct intel_display *display = to_intel_display(crtc);
        char *chipname = a->use_c10 ? "C10" : "C20";
 
-       pipe_config_mismatch(p, fastset, crtc, name, chipname);
+       pipe_config_mismatch(p, fastset, crtc, name, "%s", chipname);
 
        drm_printf(p, "expected:\n");
        intel_cx0pll_dump_hw_state(display, a);
@@ -5022,9 +5022,8 @@ pipe_config_lt_phy_pll_mismatch(struct drm_printer *p, 
bool fastset,
                                const struct intel_lt_phy_pll_state *b)
 {
        struct intel_display *display = to_intel_display(crtc);
-       char *chipname = "LTPHY";
 
-       pipe_config_mismatch(p, fastset, crtc, name, chipname);
+       pipe_config_mismatch(p, fastset, crtc, name, "LTPHY");
 
        drm_printf(p, "expected:\n");
        intel_lt_phy_dump_hw_state(display, a);
-- 
2.39.5

Reply via email to