aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c/mvtwsi.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt2018-01-31 00:57:17 +0100
committerHeiko Schocher2018-02-06 07:02:32 +0100
commit8bcf12ccce89ef9c77d9322930445b4f4ca3b822 (patch)
treed79f23fb6ae97c0b1488c97a670f36439439555e /drivers/i2c/mvtwsi.c
parent9cef983d1c5d3c4150f70346346ace29b1dfe432 (diff)
i2c: mvtwsi.c: Avoid NULL dereference
For '#ifndef CONFIG_DM_I2C' twsi_i2c_init() passes NULL as 4th parameter to __twsi_i2c_init(). Identified with cppcheck. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'drivers/i2c/mvtwsi.c')
-rw-r--r--drivers/i2c/mvtwsi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index dfbc4e053f5..30bee0d52e5 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -490,7 +490,8 @@ static void __twsi_i2c_init(struct mvtwsi_registers *twsi, int speed,
/* Reset controller */
twsi_reset(twsi);
/* Set speed */
- *actual_speed = __twsi_i2c_set_bus_speed(twsi, speed);
+ if (actual_speed)
+ *actual_speed = __twsi_i2c_set_bus_speed(twsi, speed);
/* Set slave address; even though we don't use it */
writel(slaveadd, &twsi->slave_address);
writel(0, &twsi->xtnd_slave_addr);