diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-03-03 10:52:16 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-10 15:33:37 -0500 |
commit | 085617a1eb865c2987c05652bf82d35f500ac4b4 (patch) | |
tree | 86586bae1f8d74edeeb79bc4272e3764793c430a /drivers/usb/gadget | |
parent | 991cd26249e775c07347ab4d62adfbc3284e7704 (diff) | |
download | linux-085617a1eb865c2987c05652bf82d35f500ac4b4.tar.gz linux-085617a1eb865c2987c05652bf82d35f500ac4b4.tar.bz2 linux-085617a1eb865c2987c05652bf82d35f500ac4b4.zip |
usb: gadget: printer: define pnp string buffer length
Avoid using magic numbers.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/legacy/printer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c index 84e6cdd72137..db5e2f0681c7 100644 --- a/drivers/usb/gadget/legacy/printer.c +++ b/drivers/usb/gadget/legacy/printer.c @@ -276,9 +276,11 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget, /* descriptors that are built on-demand */ +#define PNP_STRING_LEN 1024 + static char product_desc [40] = DRIVER_DESC; static char serial_num [40] = "1"; -static char pnp_string [1024] = +static char pnp_string[PNP_STRING_LEN] = "XXMFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"; /* static strings, in UTF-8 */ @@ -1247,7 +1249,7 @@ static int f_printer_bind_config(struct usb_configuration *c, char *pnp_str, INIT_LIST_HEAD(&dev->rx_buffers); if (pnp_str) - strlcpy(&pnp_string[2], pnp_str, sizeof(pnp_string) - 2); + strlcpy(&pnp_string[2], pnp_str, PNP_STRING_LEN - 2); len = strlen(pnp_string); pnp_string[0] = (len >> 8) & 0xFF; |