From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ahmed S. Darwish" Subject: [PATCH v5 2/2] can: kvaser_usb: Fix sparse warning __le16 degrades to integer Date: Sun, 15 Mar 2015 11:10:49 -0400 Message-ID: <20150315151049.GB4492@linux> References: <20150226152011.GA6075@linux> <20150315150338.GA4492@linux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-wi0-f171.google.com ([209.85.212.171]:34023 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbbCOPKy (ORCPT ); Sun, 15 Mar 2015 11:10:54 -0400 Content-Disposition: inline In-Reply-To: <20150315150338.GA4492@linux> Sender: linux-can-owner@vger.kernel.org List-ID: To: Olivier Sobrie , Oliver Hartkopp , Wolfgang Grandegger , Marc Kleine-Budde , Andri Yngvason Cc: Linux-CAN , LKML From: Ahmed S. Darwish USB endpoint's wMaxPacketSize field is an le16 entity. Use appropriate le16_to_cpu macros to maintain endian independence. Reported-by: Marc Kleine-Budde Signed-off-by: Ahmed S. Darwish --- drivers/net/can/usb/kvaser_usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) I wasn't successful in making sparse trigger the warning, even while using the latest version from the git repos and doing: make C=2 M=drivers/net/can/usb So, Marc, I hope this patch fixes the issue reported; it should. thanks, diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 60eadf5..d924016 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -596,8 +596,8 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, * for further details. */ if (tmp->len == 0) { - pos = round_up(pos, - dev->bulk_in->wMaxPacketSize); + pos = round_up(pos, le16_to_cpu(dev->bulk_in-> + wMaxPacketSize)); continue; } @@ -1337,7 +1337,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) * number of events in case of a heavy rx load on the bus. */ if (msg->len == 0) { - pos = round_up(pos, dev->bulk_in->wMaxPacketSize); + pos = round_up(pos, le16_to_cpu(dev->bulk_in-> + wMaxPacketSize)); continue; } -- 1.9.1