drm/display: Fix building with GCC 15
Subsystems (2)
PATCH 1/1 drm/display: Fix building with GCC 15
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of dp_dual_mode_hdmi_id array by one, so that it can accommodate the new line character. This should let us build the kernel with GCC 15.
--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +3 -2
@@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = +//+1 to avaoid spurious -Werror=unterminated-string-initialization warning +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
2.46.2
Quoted 6 lines · Brahmajit Das
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
Quoted 6 lines
164 | "DP-HDMI ADAPTOR\x04"; | ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_idarray by one, so that it can accommodate the new line character. This should let us build the kernel with GCC 15.
Should be terminating NUL, not new line.
Quoted 11 lines
Signed-off-by Brahmajit Das <[email protected]>--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +0
-0
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c EXPORT_SYMBOL(drm_dp_dual_mode_write); · line 163
Quoted 5 lines
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +1
-1@@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { - static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = +//+1 to avaoid spurious -Werror=unterminated-string-initialization warning
If we added comments for every little thing like this, there'd be more comments than code. ;)
Quoted 9 lines
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2
-1+static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
Jani Nikula, Intel
PATCH v2 1/1 drm/display: Fix building with GCC 15
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of dp_dual_mode_hdmi_id array by one, so that it can accommodate the new line character. This should let us build the kernel with GCC 15.
--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +3 -3
@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = -"DP-HDMI ADAPTOR\x04" ; +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] = +"DP-HDMI ADAPTOR\x00" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
2.46.2
PATCH v3 1/1 drm/display: Fix building with GCC 15
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of dp_dual_mode_hdmi_id array by one, so that it can accommodate the NULL line character. This should let us build the kernel with GCC 15.
--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2 -2
@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
2.46.2
Quoted 6 lines · Brahmajit Das
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
Quoted 6 lines
164 | "DP-HDMI ADAPTOR\x04"; | ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_idarray by one, so that it can accommodate the NULL line character. This should let us build the kernel with GCC 15.
Still s/NULL line/NUL/ but this can be fixed while applying, no need to resend.
Quoted 24 lines
Signed-off-by Brahmajit Das <[email protected]>--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2
-2@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
Jani Nikula, Intel
Jani Nikula
AppliedQuoted 10 lines · Jani Nikula
Quoted 9 lines · Brahmajit Das
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]164 | "DP-HDMI ADAPTOR\x04"; | ^~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Quoted 3 lines
After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_idarray by one, so that it can accommodate the NULL line character. This should let us build the kernel with GCC 15.Still s/NULL line/NUL/ but this can be fixed while applying, no need to resend.
Reviewed-by Jani Nikula <[email protected]>
Pushed to drm-misc-next, and forgot to update the commit message. Oh well. My bad.
Thanks for the patch.
BR,
Jani.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Brahmajit Das <[email protected]>--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2
-2@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
Jani Nikula, Intel
Quoted 28 lines · Jani Nikula
Quoted 6 lines · Brahmajit Das
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]Quoted 6 lines
164 | "DP-HDMI ADAPTOR\x04"; | ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_idarray by one, so that it can accommodate the new line character. This should let us build the kernel with GCC 15.Should be terminating NUL, not new line.
Quoted 12 lines
Signed-off-by Brahmajit Das <[email protected]>--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +0
-0@@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
Quoted 7 lines
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c EXPORT_SYMBOL(drm_dp_dual_mode_write); · line 163
Quoted 4 lines
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +1
-1static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { - static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = +//+1 to avaoid spurious -Werror=unterminated-string-initialization warning If we added comments for every little thing like this, there'd be more comments than code. ;)
I asked for a comment, otherwise I suspect I''d end up undoing this after forgetting why it's there. OTOH maybe I'll get the "broken" gcc upgrade before I look at this code again, which would solve that particular problem.
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2
-1+static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)Signature · 1 line
Jani Nikula, Intel
Signature · 2 lines
Ville Syrjälä Intel