drm/amd/display: fix USR retraining support check
PATCH 1/1 drm/amd/display: fix USR retraining support check
From: Mohammad Shahid <[email protected]>
The USR retraining support check tests the address of USRRetrainingSupport[j] instead of its Boolean value.
Since the address of the array element is non-NULL,the condition can always true, even when USR retraining is required but not supported.
This issue is reported by script test_addr.cocci.
--- drivers/gpu/drm/amd/display/dc/dml2_0/display_mode_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2_0/display_mode_util.c +1 -1
@@ -412,7 +412,7 @@ void dml_print_mode_support(struct display_mode_lib_st *mode_lib, dml_uint_t j)dml_print ("DML: MODE SUPPORT: Host VM or Immediate Flip Supported : %s\n" , ((mode_lib->ms.cache_display_cfg.plane.HostVMEnable == false && !mode_lib->scratch.dml_core_mode_support_locals.ImmediateFlipRequiredFinal) || mode_lib->ms.support.ImmediateFlipSupportedForState[j]) ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: dram clock change support : %s\n" , mode_lib->scratch.dml_core_mode_support_locals.dram_clock_change_support == true ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: f_clock change support : %s\n" , mode_lib->scratch.dml_core_mode_support_locals.f_clock_change_support == true ?"Supported" :"NOT Supported" ); -dml_print ("DML: MODE SUPPORT: USR Retraining Support : %s\n" , (!mode_lib->ms.policy.USRRetrainingRequiredFinal || &mode_lib->ms.support.USRRetrainingSupport[j]) ?"Supported" :"NOT Supported" ); +dml_print ("DML: MODE SUPPORT: USR Retraining Support : %s\n" , (!mode_lib->ms.policy.USRRetrainingRequiredFinal || mode_lib->ms.support.USRRetrainingSupport[j]) ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: ===============================================\n" ); }
Signature · 1 line
2.43.0
Hi ,
could you please review this patch and give your feedback ,when time permits.
Thanks
Shahid.
Quoted 34 lines · On 2026-11-01 16:17 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
The USR retraining support check tests the address of USRRetrainingSupport[j] instead of its Boolean value.
Since the address of the array element is non-NULL,the condition can always true, even when USR retraining is required but not supported.
This issue is reported by script
test_addr.cocci.Signed-off-by Mohammad Shahid <[email protected]>--- drivers/gpu/drm/amd/display/dc/dml2_0/display_mode_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dml2_0/display_mode_util.c +1
-1@@ -412,7 +412,7 @@ void dml_print_mode_support(struct display_mode_lib_st *mode_lib, dml_uint_t j)dml_print ("DML: MODE SUPPORT: Host VM or Immediate Flip Supported : %s\n" , ((mode_lib->ms.cache_display_cfg.plane.HostVMEnable == false && !mode_lib->scratch.dml_core_mode_support_locals.ImmediateFlipRequiredFinal) || mode_lib->ms.support.ImmediateFlipSupportedForState[j]) ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: dram clock change support : %s\n" , mode_lib->scratch.dml_core_mode_support_locals.dram_clock_change_support == true ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: f_clock change support : %s\n" , mode_lib->scratch.dml_core_mode_support_locals.f_clock_change_support == true ?"Supported" :"NOT Supported" ); -dml_print ("DML: MODE SUPPORT: USR Retraining Support : %s\n" , (!mode_lib->ms.policy.USRRetrainingRequiredFinal || &mode_lib->ms.support.USRRetrainingSupport[j]) ?"Supported" :"NOT Supported" ); +dml_print ("DML: MODE SUPPORT: USR Retraining Support : %s\n" , (!mode_lib->ms.policy.USRRetrainingRequiredFinal || mode_lib->ms.support.USRRetrainingSupport[j]) ?"Supported" :"NOT Supported" );dml_print ("DML: MODE SUPPORT: ===============================================\n" ); }Signature · 1 line
2.43.0