aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/dln2.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-11-18 07:58:00 -0500
committerLee Jones <lee.jones@linaro.org>2014-11-19 12:12:59 -0500
commit2fc2b4846c14c8c2d2c6e9114b4548f846521cfb (patch)
treea0ac1c77014dc151642b787e4d68608c06fd7e36 /drivers/mfd/dln2.c
parent00ee7a37fdc3ed9bc6315f8af0270f2df55437d7 (diff)
mfd: dln2: A couple endian fixes
Sparse catches a couple endian bugs. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Octavian Purdila <octavian.purdila@intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/dln2.c')
-rw-r--r--drivers/mfd/dln2.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index df2fda9cd3db..559e6cc3e022 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -436,6 +436,7 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
436 struct device *dev = &dln2->interface->dev; 436 struct device *dev = &dln2->interface->dev;
437 const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000; 437 const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000;
438 struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle]; 438 struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
439 int size;
439 440
440 spin_lock(&dln2->disconnect_lock); 441 spin_lock(&dln2->disconnect_lock);
441 if (!dln2->disconnect) 442 if (!dln2->disconnect)
@@ -477,8 +478,9 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
477 478
478 /* if we got here we know that the response header has been checked */ 479 /* if we got here we know that the response header has been checked */
479 rsp = rxc->urb->transfer_buffer; 480 rsp = rxc->urb->transfer_buffer;
481 size = le16_to_cpu(rsp->hdr.size);
480 482
481 if (rsp->hdr.size < sizeof(*rsp)) { 483 if (size < sizeof(*rsp)) {
482 ret = -EPROTO; 484 ret = -EPROTO;
483 goto out_free_rx_slot; 485 goto out_free_rx_slot;
484 } 486 }
@@ -493,8 +495,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
493 if (!ibuf) 495 if (!ibuf)
494 goto out_free_rx_slot; 496 goto out_free_rx_slot;
495 497
496 if (*ibuf_len > rsp->hdr.size - sizeof(*rsp)) 498 if (*ibuf_len > size - sizeof(*rsp))
497 *ibuf_len = rsp->hdr.size - sizeof(*rsp); 499 *ibuf_len = size - sizeof(*rsp);
498 500
499 memcpy(ibuf, rsp + 1, *ibuf_len); 501 memcpy(ibuf, rsp + 1, *ibuf_len);
500 502