peak_usb: fix clang build warning
authorArnd Bergmann <arnd@arndb.de>
Thu, 7 Mar 2019 10:31:55 +0000 (11:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Mar 2019 17:39:46 +0000 (09:39 -0800)
Clang points out undefined behavior when building the pcan_usb_pro driver:

drivers/net/can/usb/peak_usb/pcan_usb_pro.c:136:15: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]

Changing the function prototype to avoid argument promotion in the
varargs call avoids the warning, and should make this well-defined.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/can/usb/peak_usb/pcan_usb_pro.c

index d516def846abec6c661dc185da1d64b73ca22441..b388406ac0f569f33bc56cf65171204d24c86bd4 100644 (file)
@@ -127,7 +127,7 @@ static u8 *pcan_msg_init_empty(struct pcan_usb_pro_msg *pm,
 /*
  * add one record to a message being built
  */
-static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, u8 id, ...)
+static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
 {
        int len, i;
        u8 *pc;