Skip to content

Commit

Permalink
[media] saa7164: fix endian conversion in saa7164_bus_set()
Browse files Browse the repository at this point in the history
The msg->command field is 32 bits, and we should fill it with a call
to cpu_to_le32().  The current code is broke on big endian systems.
On little endian systems it truncates the 32 bit value to 16 bits
which probably still works fine.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Dec 11, 2011
1 parent ed942c5 commit 773ddbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/video/saa7164/saa7164-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg,
saa7164_bus_verify(dev);

msg->size = cpu_to_le16(msg->size);
msg->command = cpu_to_le16(msg->command);
msg->command = cpu_to_le32(msg->command);
msg->controlselector = cpu_to_le16(msg->controlselector);

if (msg->size > dev->bus.m_wMaxReqSize) {
Expand Down Expand Up @@ -464,7 +464,7 @@ int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,

peekout:
msg->size = le16_to_cpu(msg->size);
msg->command = le16_to_cpu(msg->command);
msg->command = le32_to_cpu(msg->command);
msg->controlselector = le16_to_cpu(msg->controlselector);
ret = SAA_OK;
out:
Expand Down

0 comments on commit 773ddbd

Please sign in to comment.