summaryrefslogtreecommitdiffstats
path: root/drivers/i3c
diff options
context:
space:
mode:
authorJamie Iles <quic_jiles@quicinc.com>2021-09-22 18:56:00 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2021-12-10 15:54:46 +0100
commitf18f98110f2b179792cb70d85cba697320a3790f (patch)
treeb0657195e0daf3765fc3da69c6d8267a7bfbd0ee /drivers/i3c
parenti3c/master/mipi-i3c-hci: Prefer kcalloc over open coded arithmetic (diff)
downloadlinux-f18f98110f2b179792cb70d85cba697320a3790f.tar.xz
linux-f18f98110f2b179792cb70d85cba697320a3790f.zip
i3c: fix incorrect address slot lookup on 64-bit
The address slot bitmap is an array of unsigned long's which are the same size as an int on 32-bit platforms but not 64-bit. Loading the bitmap into an int could result in the incorrect status being returned for a slot and slots being reported as the wrong status. Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Cc: Boris Brezillon <bbrezillon@kernel.org> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Jamie Iles <quic_jiles@quicinc.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210922165600.179394-1-quic_jiles@quicinc.com
Diffstat (limited to 'drivers/i3c')
-rw-r--r--drivers/i3c/master.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index c3b4c677b442..dfe18dcd008d 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -343,7 +343,8 @@ struct bus_type i3c_bus_type = {
static enum i3c_addr_slot_status
i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
{
- int status, bitpos = addr * 2;
+ unsigned long status;
+ int bitpos = addr * 2;
if (addr > I2C_MAX_ADDR)
return I3C_ADDR_SLOT_RSVD;