drm/amd/display: Add gnu_printf format attribute for snprintf_count()
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 2 Jun 2023 15:38:49 +0000 (21:08 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 16:38:29 +0000 (12:38 -0400)
commitd6634d4d92eac068e2136afab49dfb15a9efae74
tree021655e7aeaffe58d2a3725038333a1f83501395
parent6b37fee590ec842f6e172c4f9c7dc4baadbdfda2
drm/amd/display: Add gnu_printf format attribute for snprintf_count()

Fix the following W=1 kernel build warning:

display/dc/dcn10/dcn10_hw_sequencer_debug.c: In function ‘snprintf_count’:
display/dc/dcn10/dcn10_hw_sequencer_debug.c:56:2: warning: function ‘snprintf_count’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Use the __printf() attribute to let the compiler warn if
invalid format strings are passed in.

And fix the following checks:

CHECK: Avoid CamelCase: <pBuf> +unsigned int __printf(3, 4)
snprintf_count(char *pBuf, unsigned int bufSize, char *fmt, ...)

CHECK: Avoid CamelCase: <bufSize> +unsigned int __printf(3, 4)
snprintf_count(char *pBuf, unsigned int bufSize, char *fmt, ...)

Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c