From: Dan Carpenter Date: Mon, 28 Nov 2011 12:08:53 +0000 (-0300) Subject: [media] saa7164: fix endian conversion in saa7164_bus_set() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=773ddbd228dc16a4829836e1dc16383e44c8575e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] saa7164: fix endian conversion in saa7164_bus_set() 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 Cc: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/saa7164/saa7164-bus.c b/drivers/media/video/saa7164/saa7164-bus.c index 466e1b02f91f..a7f58a998752 100644 --- a/drivers/media/video/saa7164/saa7164-bus.c +++ b/drivers/media/video/saa7164/saa7164-bus.c @@ -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) { @@ -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: