Linux-USB Archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Krishna Kurapati <quic_kriskura@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	quic_ppratap@quicinc.com, quic_jackp@quicinc.com,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call
Date: Fri, 26 Apr 2024 11:46:45 +0200	[thread overview]
Message-ID: <Zit4BfDgDpZDEVxp@hovoldconsulting.com> (raw)
In-Reply-To: <20240426050512.57384-1-quic_kriskura@quicinc.com>

On Fri, Apr 26, 2024 at 10:35:12AM +0530, Krishna Kurapati wrote:
> Recent commit introduced support for reading Multiport PHYs and
> while doing so iterated over an integer variable which runs from
> [0-254] in the worst case scenario. But S390 compiler treats it as a
> warning and complains that the integer write to string can go to 11
> characters. Fix this by modifying iterator variable to u8.
> 
> Suggested-by: Johan Hovold <johan@kernel.org>
> Fixes: 30a46746ca5a ("usb: dwc3: core: Refactor PHY logic to support Multiport Controller")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202404241215.Mib19Cu7-lkp@intel.com/
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> ---
>  drivers/usb/dwc3/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 4dc6fc79c6d9..719305ab86c0 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1449,7 +1449,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
>  	struct device_node	*node = dev->of_node;
>  	char phy_name[9];
>  	int ret;
> -	int i;
> +	u8 i;

Perhaps unsigned int would have been better, but this should work too
(the broken compiler did get the upper bound right).

I assume you did not install a cross-compiler and tried to reproduce the
bogus warning?

In any case, if we want to suppress that bogus W=1 warning, this looks
good to me:

Reviewed-by: Johan Hovold <johan+linaro@kernel.org>

Johan

      reply	other threads:[~2024-04-26  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  5:05 [PATCH] usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call Krishna Kurapati
2024-04-26  9:46 ` Johan Hovold [this message]

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=Zit4BfDgDpZDEVxp@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_kriskura@quicinc.com \
    --cc=quic_ppratap@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).