diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2017-07-24 11:30:15 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-09-20 16:58:16 +0200 |
commit | b203d192da6ffdf0ce66689df97ac1a0719b1e85 (patch) | |
tree | 766a7c8c41c2ab4f60ea2304a44d7b05934179d1 | |
parent | 0d3d48f0ef968ab1cc196d79c97dfdcd28995b87 (diff) |
tegra_udc.c: fix compilation with gcc 7
With gcc 7 the following compile time error occurs:
| .../drivers/usb/gadget/tegra_udc.c:2565:17: error: 'out' directive writing 3 bytes into a region of size between 2 and 11 [-Werror=format-overflow=]
| sprintf(name, "ep%dout", i);
| ^~~~~~~~~
| .../drivers/usb/gadget/tegra_udc.c:2565:3: note: 'sprintf' output between 7 and 16 bytes into a destination of size 14
| sprintf(name, "ep%dout", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
The last end point will never be greater than 32 but the compiler can
not find this out from the code. Work around this by passing a format
specifier to interpreat i as a signed char.
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | drivers/usb/gadget/tegra_udc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/tegra_udc.c b/drivers/usb/gadget/tegra_udc.c index 074a9b1ce6d9..0c90d94bd0e2 100644 --- a/drivers/usb/gadget/tegra_udc.c +++ b/drivers/usb/gadget/tegra_udc.c @@ -2562,9 +2562,9 @@ static int tegra_udc_ep_setup(struct tegra_udc *udc) for (i = 1; i < (int)(udc->max_ep / 2); i++) { char name[14]; - sprintf(name, "ep%dout", i); + sprintf(name, "ep%hhdout", i); struct_ep_setup(udc, i * 2, name, 1); - sprintf(name, "ep%din", i); + sprintf(name, "ep%hhdin", i); struct_ep_setup(udc, i * 2 + 1, name, 1); } |