Commit c504d963 authored by Yicong Yang's avatar Yicong Yang Committed by Zhou Juan
Browse files

i2c: hisi: Only handle the interrupt of the driver's transfer

mainline inclusion
from mainline-v6.5-rc7
commit fff67c1b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7ZBU0?from=project-issue
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fff67c1b17ee



----------------------------------------------------------------------

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: d62fbdb9 ("i2c: add support for HiSilicon I2C controller")
Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20230801124625.63587-1-yangyicong@huawei.com


Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarJuan Zhou <zhoujuan51@h-partners.com>
parent 5a9bf845
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -334,6 +334,14 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
	struct hisi_i2c_controller *ctlr = context;
	u32 int_stat;

	/*
	 * Don't handle the interrupt if cltr->completion is NULL. We may
	 * reach here because the interrupt is spurious or the transfer is
	 * started by another port (e.g. firmware) rather than us.
	 */
	if (!ctlr->completion)
		return IRQ_NONE;

	int_stat = readl(ctlr->iobase + HISI_I2C_INT_MSTAT);
	hisi_i2c_clear_int(ctlr, int_stat);
	if (!(int_stat & HISI_I2C_INT_ALL))