Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/usb/kalmia: use ARRAY_SIZE for various array sizing calculations

Use the ARRAY_SIZE macro on a couple of arrays to determine
size of the arrays. Also fix up alignment to clean up a checkpatch
warning. Improvement suggested by Coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Colin Ian King and committed by
David S. Miller
b72c8a7e 3c34cb9d

+4 -4
+4 -4
drivers/net/usb/kalmia.c
··· 114 114 return -ENOMEM; 115 115 116 116 memcpy(usb_buf, init_msg_1, 12); 117 - status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_1) 118 - / sizeof(init_msg_1[0]), usb_buf, 24); 117 + status = kalmia_send_init_packet(dev, usb_buf, ARRAY_SIZE(init_msg_1), 118 + usb_buf, 24); 119 119 if (status != 0) 120 120 return status; 121 121 122 122 memcpy(usb_buf, init_msg_2, 12); 123 - status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_2) 124 - / sizeof(init_msg_2[0]), usb_buf, 28); 123 + status = kalmia_send_init_packet(dev, usb_buf, ARRAY_SIZE(init_msg_2), 124 + usb_buf, 28); 125 125 if (status != 0) 126 126 return status; 127 127