public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers:usb: use get|put_unaligned_le16
@ 2013-06-25 13:54 Piotr Wilczek
  2013-06-25 18:52 ` Marek Vasut
  2013-06-26  6:22 ` [U-Boot] [PATCH v2] " Piotr Wilczek
  0 siblings, 2 replies; 4+ messages in thread
From: Piotr Wilczek @ 2013-06-25 13:54 UTC (permalink / raw)
  To: u-boot

This patch use get|put_unaligned_le16 to access structure data
to avoid data abort on some ARM platforms.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Marek Vasut <marex@denx.de>
---
 drivers/usb/gadget/f_mass_storage.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index c28866f..b7e0df3 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -577,9 +577,9 @@ static int fsg_setup(struct usb_function *f,
 {
 	struct fsg_dev		*fsg = fsg_from_func(f);
 	struct usb_request	*req = fsg->common->ep0req;
-	u16			w_index = le16_to_cpu(ctrl->wIndex);
-	u16			w_value = le16_to_cpu(ctrl->wValue);
-	u16			w_length = le16_to_cpu(ctrl->wLength);
+	u16			w_index = get_unaligned_le16(&ctrl->wIndex);
+	u16			w_value = get_unaligned_le16(&ctrl->wValue);
+	u16			w_length = get_unaligned_le16(&ctrl->wLength);
 
 	if (!fsg_is_set(fsg->common))
 		return -EOPNOTSUPP;
@@ -617,7 +617,7 @@ static int fsg_setup(struct usb_function *f,
 	     "unknown class-specific control req "
 	     "%02x.%02x v%04x i%04x l%u\n",
 	     ctrl->bRequestType, ctrl->bRequest,
-	     le16_to_cpu(ctrl->wValue), w_index, w_length);
+	     get_unaligned_le16(&ctrl->wValue), w_index, w_length);
 	return -EOPNOTSUPP;
 }
 
@@ -2261,7 +2261,7 @@ reset:
 	if (rc)
 		goto reset;
 	fsg->bulk_out_enabled = 1;
-	common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize);
+	common->bulk_out_maxpacket = get_unaligned_le16(&d->wMaxPacketSize);
 	clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
 
 	/* Allocate the requests */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] drivers:usb: use get|put_unaligned_le16
  2013-06-25 13:54 [U-Boot] [PATCH] drivers:usb: use get|put_unaligned_le16 Piotr Wilczek
@ 2013-06-25 18:52 ` Marek Vasut
  2013-06-26  6:22 ` [U-Boot] [PATCH v2] " Piotr Wilczek
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2013-06-25 18:52 UTC (permalink / raw)
  To: u-boot

Dear Piotr Wilczek,

> This patch use get|put_unaligned_le16 to access structure data
> to avoid data abort on some ARM platforms.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Marek Vasut <marex@denx.de>
> ---
>  drivers/usb/gadget/f_mass_storage.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Can you please rebase on top of u-boot-usb/master?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] drivers:usb: use get|put_unaligned_le16
  2013-06-25 13:54 [U-Boot] [PATCH] drivers:usb: use get|put_unaligned_le16 Piotr Wilczek
  2013-06-25 18:52 ` Marek Vasut
@ 2013-06-26  6:22 ` Piotr Wilczek
  2013-06-26 11:21   ` Marek Vasut
  1 sibling, 1 reply; 4+ messages in thread
From: Piotr Wilczek @ 2013-06-26  6:22 UTC (permalink / raw)
  To: u-boot

This patch use get|put_unaligned_le16 to access structure data
to avoid data abort on some ARM platforms.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Marek Vasut <marex@denx.de>
---
Changes for v2:
- rebased on top of u-boot-usb/master

 drivers/usb/gadget/f_mass_storage.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 45bc132..5b348d7 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -577,9 +577,9 @@ static int fsg_setup(struct usb_function *f,
 {
 	struct fsg_dev		*fsg = fsg_from_func(f);
 	struct usb_request	*req = fsg->common->ep0req;
-	u16			w_index = le16_to_cpu(ctrl->wIndex);
-	u16			w_value = le16_to_cpu(ctrl->wValue);
-	u16			w_length = le16_to_cpu(ctrl->wLength);
+	u16			w_index = get_unaligned_le16(&ctrl->wIndex);
+	u16			w_value = get_unaligned_le16(&ctrl->wValue);
+	u16			w_length = get_unaligned_le16(&ctrl->wLength);
 
 	if (!fsg_is_set(fsg->common))
 		return -EOPNOTSUPP;
@@ -617,7 +617,7 @@ static int fsg_setup(struct usb_function *f,
 	     "unknown class-specific control req "
 	     "%02x.%02x v%04x i%04x l%u\n",
 	     ctrl->bRequestType, ctrl->bRequest,
-	     le16_to_cpu(ctrl->wValue), w_index, w_length);
+	     get_unaligned_le16(&ctrl->wValue), w_index, w_length);
 	return -EOPNOTSUPP;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] drivers:usb: use get|put_unaligned_le16
  2013-06-26  6:22 ` [U-Boot] [PATCH v2] " Piotr Wilczek
@ 2013-06-26 11:21   ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2013-06-26 11:21 UTC (permalink / raw)
  To: u-boot

Dear Piotr Wilczek,

> This patch use get|put_unaligned_le16 to access structure data
> to avoid data abort on some ARM platforms.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Marek Vasut <marex@denx.de>

Applied, thanks!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-26 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-25 13:54 [U-Boot] [PATCH] drivers:usb: use get|put_unaligned_le16 Piotr Wilczek
2013-06-25 18:52 ` Marek Vasut
2013-06-26  6:22 ` [U-Boot] [PATCH v2] " Piotr Wilczek
2013-06-26 11:21   ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox