Bluetooth: Fix endian and alignment issue with ath3k version handling
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Jul 2014 15:29:59 +0000 (17:29 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 20 Jul 2014 15:42:14 +0000 (18:42 +0300)
commit72dd2b2a44d82118714e0821fa16c65f9e40eb00
tree1f52deaa7b8ef3ed933739a50be2a877a06544c9
parentd1d588c181e35d98113f91c8004f77cdac2bf9d5
Bluetooth: Fix endian and alignment issue with ath3k version handling

The ath3k driver is treating the version information badly when it
comes to loading the right firmware version and comparing that it
actually matches with the hardware.

Initially this showed up as this:

  CHECK   drivers/bluetooth/ath3k.c
drivers/bluetooth/ath3k.c:373:17: warning: cast to restricted __le32
drivers/bluetooth/ath3k.c:435:17: warning: cast to restricted __le32

However when fixing this by actually using __packed and __le32 for
the ath3_version structure, more issues came up:

  CHECK   drivers/bluetooth/ath3k.c
drivers/bluetooth/ath3k.c:381:32: warning: incorrect type in assignment (different base types)
drivers/bluetooth/ath3k.c:381:32:    expected restricted __le32 [usertype] rom_version
drivers/bluetooth/ath3k.c:381:32:    got int [signed] <noident>
drivers/bluetooth/ath3k.c:382:34: warning: incorrect type in assignment (different base types)
drivers/bluetooth/ath3k.c:382:34:    expected restricted __le32 [usertype] build_version
drivers/bluetooth/ath3k.c:382:34:    got int [signed] <noident>
drivers/bluetooth/ath3k.c:386:28: warning: restricted __le32 degrades to integer
drivers/bluetooth/ath3k.c:386:56: warning: restricted __le32 degrades to integer

This patch fixes every instance of the firmware version handling and
makes sure it is endian safe and uses proper unaligned access.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
drivers/bluetooth/ath3k.c