Skip to content

Commit 62931ac

Browse files
FaboWolfram Sang
authored andcommitted
i2c: mt65xx: fix NULL ptr dereference
Since commit abf4923 ("i2c: mediatek: disable zero-length transfers for mt8183"), there is a NULL pointer dereference for all the SoCs that don't have any quirk. mtk_i2c_functionality is not checking that the quirks pointer is not NULL before starting to use it. This commit add a call to i2c_check_quirks which will check whether the quirks pointer is set, and if so will check if the IP has the NO_ZERO_LEN quirk. Fixes: abf4923 ("i2c: mediatek: disable zero-length transfers for mt8183") Signed-off-by: Fabien Parent <[email protected]> Reviewed-by: Cengiz Can <[email protected]> Reviewed-by: Hsin-Yi Wang <[email protected]> Tested-by: Ulrich Hecht <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 1f0d9cb commit 62931ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
875875

876876
static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
877877
{
878-
if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
878+
if (i2c_check_quirks(adap, I2C_AQ_NO_ZERO_LEN))
879879
return I2C_FUNC_I2C |
880880
(I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
881881
else

0 commit comments

Comments
 (0)