mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
i2c: mt65xx: fix NULL ptr dereference
Since commitabf4923e97
("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:abf4923e97
("i2c: mediatek: disable zero-length transfers for mt8183") Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-by: Cengiz Can <cengiz@kernel.wtf> Reviewed-by: Hsin-Yi Wang <hsinyi@chromium.org> Tested-by: Ulrich Hecht <uli@fpond.eu> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
1f0d9cbeec
commit
62931ac2f9
1 changed files with 1 additions and 1 deletions
|
@ -875,7 +875,7 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
|
|||
|
||||
static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
|
||||
{
|
||||
if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
|
||||
if (i2c_check_quirks(adap, I2C_AQ_NO_ZERO_LEN))
|
||||
return I2C_FUNC_I2C |
|
||||
(I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue