Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: AB8500 mask off irrelevant bits from the SPI message

The registers on the AB8500 are only 8 bits wide, so the content
of the remaining bits is undefined. Let's mask off the undefined
stuff when returning a register in an SPI read.

Acked-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Linus Walleij and committed by
Samuel Ortiz
c0d4010e eb6e8ddf

+6 -1
+6 -1
drivers/mfd/ab8500-spi.c
··· 68 68 69 69 ret = spi_sync(spi, &msg); 70 70 if (!ret) 71 - ret = ab8500->rx_buf[0]; 71 + /* 72 + * Only the 8 lowermost bytes are 73 + * defined with value, the rest may 74 + * vary depending on chip/board noise. 75 + */ 76 + ret = ab8500->rx_buf[0] & 0xFFU; 72 77 73 78 return ret; 74 79 }