UPSTREAM: usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call

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.

Bug: 254441685
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>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20240426050512.57384-1-quic_kriskura@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3f12222a4bebeb13ce06ddecc1610ad32fa835dd)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: If11b5b866842a9e94edfdfcaa7c4aea1f575e0d2
This commit is contained in:
Krishna Kurapati
2024-04-26 10:35:12 +05:30
committed by Treehugger Robot
parent 48ab183a3e
commit b29cc3971e

View File

@@ -1480,7 +1480,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
struct phy *temp_phy = NULL;
char phy_name[9];
int ret;
int i;
u8 i;
if (node) {
dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
@@ -1510,7 +1510,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
if (vdwc->num_usb2_ports == 1)
snprintf(phy_name, sizeof(phy_name), "usb2-phy");
else
snprintf(phy_name, sizeof(phy_name), "usb2-%d", i);
snprintf(phy_name, sizeof(phy_name), "usb2-%u", i);
temp_phy = devm_phy_get(dev, phy_name);
if (IS_ERR(temp_phy)) {
@@ -1532,7 +1532,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
if (vdwc->num_usb3_ports == 1)
snprintf(phy_name, sizeof(phy_name), "usb3-phy");
else
snprintf(phy_name, sizeof(phy_name), "usb3-%d", i);
snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
temp_phy = devm_phy_get(dev, phy_name);
if (IS_ERR(temp_phy)) {