Skip to content

Commit fff67c1

Browse files
Yicong Yangwsakernel
authored andcommitted
i2c: hisi: Only handle the interrupt of the driver's transfer
The controller may be shared with other port, for example the firmware. Handle the interrupt from other sources will cause crash since some data are not initialized. So only handle the interrupt of the driver's transfer and discard others. Fixes: d62fbdb ("i2c: add support for HiSilicon I2C controller") Signed-off-by: Yicong Yang <yangyicong@hisilicon.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20230801124625.63587-1-yangyicong@huawei.com Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 27ec43c commit fff67c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/i2c/busses/i2c-hisi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
330330
struct hisi_i2c_controller *ctlr = context;
331331
u32 int_stat;
332332

333+
/*
334+
* Don't handle the interrupt if cltr->completion is NULL. We may
335+
* reach here because the interrupt is spurious or the transfer is
336+
* started by another port (e.g. firmware) rather than us.
337+
*/
338+
if (!ctlr->completion)
339+
return IRQ_NONE;
340+
333341
int_stat = readl(ctlr->iobase + HISI_I2C_INT_MSTAT);
334342
hisi_i2c_clear_int(ctlr, int_stat);
335343
if (!(int_stat & HISI_I2C_INT_ALL))

0 commit comments

Comments
 (0)