All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Brahmajit Das <brahmajit.xyz@gmail.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/1] drm/display: Fix building with GCC 15
Date: Wed, 2 Oct 2024 12:50:11 +0300	[thread overview]
Message-ID: <Zv0XU3t9IYwTisb9@intel.com> (raw)
In-Reply-To: <87a5fmvrkt.fsf@intel.com>

On Wed, Oct 02, 2024 at 11:26:10AM +0300, Jani Nikula wrote:
> On Tue, 01 Oct 2024, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
> > 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.
> 
> Should be terminating NUL, not new line.
> 
> >
> > Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
> > ---
> >  drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > index 14a2a8473682..295375868db6 100644
> > --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > @@ -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. ;)

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.

> 
> > +	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)
> 
> -- 
> Jani Nikula, Intel

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2024-10-02  9:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 14:42 [PATCH 1/1] drm/display: Fix building with GCC 15 Brahmajit Das
2024-10-02  8:26 ` Jani Nikula
2024-10-02  9:06   ` [PATCH v2] " Brahmajit Das
2024-10-02  9:23     ` [PATCH v3] " Brahmajit Das
2024-10-02  9:47       ` Jani Nikula
2024-10-10 12:04         ` Jani Nikula
2024-10-02  9:50   ` Ville Syrjälä [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-01 14:27 [PATCH 1/1] " Brahmajit Das
2024-10-01 14:14 Build failure with GCC 15 in drivers/gpu/drm/display/drm_dp_dual_mode_helper.c Brahmajit
2024-10-01 14:36 ` [PATCH 1/1] drm/display: Fix building with GCC 15 Brahmajit Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zv0XU3t9IYwTisb9@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=brahmajit.xyz@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.