summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/stmfx.c
Commit message (Collapse)AuthorAgeFilesLines
* mfd: stmfx: Fix an endian bug in stmfx_irq_handler()Dan Carpenter2019-06-241-1/+3
| | | | | | | | | | | | It's not okay to cast a "u32 *" to "unsigned long *" when you are doing a for_each_set_bit() loop because that will break on big endian systems. Fixes: 386145601b82 ("mfd: stmfx: Uninitialized variable in stmfx_irq_handler()") Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Tested-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd: stmfx: Uninitialized variable in stmfx_irq_handler()Dan Carpenter2019-06-171-6/+4Star
| | | | | | | | | | | | | | | | | | | | The problem is that on 64bit systems then we don't clear the higher bits of the "pending" variable. So when we do: ack = pending & ~BIT(STMFX_REG_IRQ_SRC_EN_GPIO); if (ack) { the if (ack) condition relies on uninitialized data. The fix it that I've changed "pending" from an unsigned long to a u32. I changed "n" as well, because that's a number in the 0-10 range and it fits easily inside an int. We do need to add a cast to "pending" when we use it in the for_each_set_bit() loop, but that doesn't cause a problem, it's fine. Fixes: 06252ade9156 ("mfd: Add ST Multi-Function eXpander (STMFX) core driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd: Add ST Multi-Function eXpander (STMFX) core driverAmelie Delaunay2019-05-101-0/+545
STMicroelectronics Multi-Function eXpander (STMFX) is a slave controller using I2C for communication with the main MCU. Main features are: - 16 fast GPIOs individually configurable in input/output - 8 alternate GPIOs individually configurable in input/output when other STMFX functions are not used - Main MCU IDD measurement - Resistive touchscreen controller Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>