netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
	kernel@pengutronix.de,
	"Ahmed S. Darwish" <ahmed.darwish@valeo.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 2/7] can: kvaser_usb: Fix sparse warning __le16 degrades to integer
Date: Sun, 22 Mar 2015 20:13:33 +0100	[thread overview]
Message-ID: <1427051618-28318-3-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1427051618-28318-1-git-send-email-mkl@pengutronix.de>

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

USB endpoint's wMaxPacketSize field is an le16 entity. Use
appropriate le16_to_cpu macros to maintain endian independence.

Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 2f9733a8e125..57611fd91229 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;
 		}
 
-- 
2.1.4

  parent reply	other threads:[~2015-03-22 19:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22 19:13 pull-request: can 2015-03-22 Marc Kleine-Budde
2015-03-22 19:13 ` [PATCH 1/7] can: kvaser_usb: Comply with firmware max tx URBs value Marc Kleine-Budde
2015-03-22 19:13 ` Marc Kleine-Budde [this message]
2015-03-22 19:13 ` [PATCH 3/7] can: gs_usb: check for kzalloc allocation failure Marc Kleine-Budde
2015-03-22 19:13 ` [PATCH 4/7] can: peak_usb: rename usb option cmds definition and structs Marc Kleine-Budde
2015-03-22 19:13 ` [PATCH 5/7] can: peak_usb_fd: add support for ISO / non-ISO mode switching Marc Kleine-Budde
2015-03-22 19:13 ` [PATCH 6/7] can: flexcan: fix bus-off error state handling Marc Kleine-Budde
2015-03-22 19:13 ` [PATCH 7/7] can: flexcan: Deferred on Regulator return EPROBE_DEFER Marc Kleine-Budde
2015-03-24  2:36 ` pull-request: can 2015-03-22 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427051618-28318-3-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=ahmed.darwish@valeo.com \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).