The original implementation iterated over the data in buf+1 through buf+size,
whereas it should have been over the data in buf through buf+size-1.
Tested on Mac G5 PPC and BCM63281.
Signed-off-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
static inline void ltoh16_buf(u16 *buf, unsigned int size)
{
- for (size /= 2; size; size--)
+ size /= 2;
+ while (size--)
*(buf + size) = le16_to_cpu(*(buf + size));
}
static inline void htol16_buf(u16 *buf, unsigned int size)
{
- for (size /= 2; size; size--)
+ size /= 2;
+ while (size--)
*(buf + size) = cpu_to_le16(*(buf + size));
}