usb: Fix build with newer gcc

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZcG2HAAoJEEy22O7T6HE42ncP/0fyFYSYioElUh7gCfVV68dq
 yOmPYdZLZv9v4p7rFpn1/hFMt3RMUHELXL1OTkj0af4FmKyH8Q9RQ/3wRKCIVxaH
 9GMkldWiTkfdD5nFAmz87P5oTA8ztrt6iAMc7gm0zZ0kES7wl1CvSGQTJRMh5A4q
 eDM6kkXUp9PzbUuJ3XPXP4wy81CGsu4ViOanjh+kvGbQJZicZKa4ai+K8aHVAUBC
 CZOjmeMp6LV/RVJLnmbmJgFi+1HQ0EukQHioUBcIzeiab037VD7MwqDZSNPAZnqD
 94nW3CU1xD8MDYR3Hg3Dvu6PQ+emvZS+fzc6T6wcbMED6e4/TjNXkskFqh4m1zUi
 eZtaQKrsvpBoEXtrytXZ+y3OX6ppHogF5V2jobMmidrQcPPVhz0wzoWzkj6V28TL
 z9txMEWiOCZ1qAZEaMt1aIGcR9jXprEKhpf/OB0b4Xx9m0e0ewnU2AKKph/lDX7d
 r5sxiWc6Ta8WlkQTU4hD4nESblJk1N1/bosHpBsOGPuNAQcPAqguZoBZ6Fuv1LI5
 3FC7ukg9lOX5xfzfoI5pzEKzIeozpjwqOEDpJly8U9J/VCEh06m8yCNTHqGZOVYr
 GhBULY8VQqDRuvccI4lIB2SfavXbk5j3bHba2AnPiieGRPZQ28btsZ/gyhpjGccm
 dt8pW7pZf2/gsaUtldMK
 =In3i
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/usb-20170720-pull-request' into staging

usb: Fix build with newer gcc

# gpg: Signature made Thu 20 Jul 2017 09:44:55 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20170720-pull-request:
  usb: Fix build with newer gcc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-07-20 17:52:48 +01:00
commit 4439e1f156
1 changed files with 4 additions and 2 deletions

View File

@ -407,8 +407,10 @@ void usb_register_companion(const char *masterbus, USBPort *ports[],
void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr)
{
if (upstream) {
snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
upstream->path, portnr);
int l = snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
upstream->path, portnr);
/* Max string is nn.nn.nn.nn.nn, which fits in 16 bytes */
assert(l < sizeof(downstream->path));
downstream->hubcount = upstream->hubcount + 1;
} else {
snprintf(downstream->path, sizeof(downstream->path), "%d", portnr);