Skip to content

Commit

Permalink
USB: isp1760: Fix endianness-sensitivity in of_isp1760_probe()
Browse files Browse the repository at this point in the history
Data read direct from device tree properties will be in the device
tree's native endianness (i.e., big-endian).

This patch uses of_property_read_u32() to read the bus-width
property in host byte order instead.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Dave Martin authored and Greg Kroah-Hartman committed Dec 10, 2011
1 parent 7fb57a0 commit 8ad028b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/host/isp1760-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ static int of_isp1760_probe(struct platform_device *dev)
int virq;
resource_size_t res_len;
int ret;
const unsigned int *prop;
unsigned int devflags = 0;
enum of_gpio_flags gpio_flags;
u32 bus_width = 0;

drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
Expand Down Expand Up @@ -77,8 +77,8 @@ static int of_isp1760_probe(struct platform_device *dev)
devflags |= ISP1760_FLAG_ISP1761;

/* Some systems wire up only 16 of the 32 data lines */
prop = of_get_property(dp, "bus-width", NULL);
if (prop && *prop == 16)
of_property_read_u32(dp, "bus-width", &bus_width);
if (bus_width == 16)
devflags |= ISP1760_FLAG_BUS_WIDTH_16;

if (of_get_property(dp, "port1-otg", NULL) != NULL)
Expand Down

0 comments on commit 8ad028b

Please sign in to comment.