Commit 085617a1 authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: printer: define pnp string buffer length

Avoid using magic numbers.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 991cd262
...@@ -276,9 +276,11 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget, ...@@ -276,9 +276,11 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget,
/* descriptors that are built on-demand */ /* descriptors that are built on-demand */
#define PNP_STRING_LEN 1024
static char product_desc [40] = DRIVER_DESC; static char product_desc [40] = DRIVER_DESC;
static char serial_num [40] = "1"; 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;"; "XXMFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;";
/* static strings, in UTF-8 */ /* static strings, in UTF-8 */
...@@ -1247,7 +1249,7 @@ static int f_printer_bind_config(struct usb_configuration *c, char *pnp_str, ...@@ -1247,7 +1249,7 @@ static int f_printer_bind_config(struct usb_configuration *c, char *pnp_str,
INIT_LIST_HEAD(&dev->rx_buffers); INIT_LIST_HEAD(&dev->rx_buffers);
if (pnp_str) 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); len = strlen(pnp_string);
pnp_string[0] = (len >> 8) & 0xFF; pnp_string[0] = (len >> 8) & 0xFF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment