<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for the patch. We already have the fix queued:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-5.2-wip&id=672e78cab819ebe31e3b9b8abac367be8a110472" id="LPlnk729262">https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-5.2-wip&id=672e78cab819ebe31e3b9b8abac367be8a110472</a></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Arnd Bergmann <arnd@arndb.de><br>
<b>Sent:</b> Thursday, March 7, 2019 5:34 AM<br>
<b>To:</b> Wentland, Harry; Li, Sun peng (Leo); Deucher, Alexander; Koenig, Christian; Zhou, David(ChunMing)<br>
<b>Cc:</b> Nick Desaulniers; Arnd Bergmann; David Airlie; Daniel Vetter; Koo, Anthony; Cyr, Aric; Tatla, Harmanprit; Chalmers, Kenneth; Kumarasamy, Sivapiriyan; Kees Cook; Bayan Zabihiyan; Cheng, Tony; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
linux-kernel@vger.kernel.org<br>
<b>Subject:</b> [PATCH] drm/amd/display: avoid passing enum as NULL pointer</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The mod_freesync_build_vrr_infopacket() function uses rather obscure<br>
calling conventions, where an enum is passed in through a pointer,<br>
and a NULL pointer is expected to behave the same way as the zero-value<br>
(TRANSFER_FUNC_UNKNOWN).<br>
<br>
Trying to build this with clang results in a warning:<br>
<br>
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4601:3: error: expression which evaluates to zero treated<br>
as a null pointer constant of type 'const enum color_transfer_func *' [-Werror,-Wnon-literal-null-conversion]<br>
<br>
Passing it by value instead of by reference makes the code simpler<br>
and more conventional but should not change the behavior at all.<br>
<br>
Fixes: c2791297013e ("drm/amd/display: Add color bit info to freesync infoframe")<br>
Signed-off-by: Arnd Bergmann <arnd@arndb.de><br>
---<br>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 7 +++----<br>
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h | 2 +-<br>
2 files changed, 4 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
index 94a84bc57c7a..6f32fe129880 100644<br>
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
@@ -724,7 +724,7 @@ static void build_vrr_infopacket_v1(enum signal_type signal,<br>
<br>
static void build_vrr_infopacket_v2(enum signal_type signal,<br>
const struct mod_vrr_params *vrr,<br>
- const enum color_transfer_func *app_tf,<br>
+ const enum color_transfer_func app_tf,<br>
struct dc_info_packet *infopacket)<br>
{<br>
unsigned int payload_size = 0;<br>
@@ -732,8 +732,7 @@ static void build_vrr_infopacket_v2(enum signal_type signal,<br>
build_vrr_infopacket_header_v2(signal, infopacket, &payload_size);<br>
build_vrr_infopacket_data(vrr, infopacket);<br>
<br>
- if (app_tf != NULL)<br>
- build_vrr_infopacket_fs2_data(*app_tf, infopacket);<br>
+ build_vrr_infopacket_fs2_data(app_tf, infopacket);<br>
<br>
build_vrr_infopacket_checksum(&payload_size, infopacket);<br>
<br>
@@ -757,7 +756,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,<br>
const struct dc_stream_state *stream,<br>
const struct mod_vrr_params *vrr,<br>
enum vrr_packet_type packet_type,<br>
- const enum color_transfer_func *app_tf,<br>
+ const enum color_transfer_func app_tf,<br>
struct dc_info_packet *infopacket)<br>
{<br>
/* SPD info packet for FreeSync<br>
diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h b/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h<br>
index 4222e403b151..645793b924cf 100644<br>
--- a/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h<br>
+++ b/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h<br>
@@ -145,7 +145,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,<br>
const struct dc_stream_state *stream,<br>
const struct mod_vrr_params *vrr,<br>
enum vrr_packet_type packet_type,<br>
- const enum color_transfer_func *app_tf,<br>
+ const enum color_transfer_func app_tf,<br>
struct dc_info_packet *infopacket);<br>
<br>
void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,<br>
-- <br>
2.20.0<br>
<br>
</div>
</span></font></div>
</body>
</html>