Skip to content

Commit f92055a

Browse files
6by9mripard
authored andcommitted
drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised
If a call to rpi_touchscreen_i2c_write from rpi_touchscreen_probe fails before mipi_dsi_device_register_full is called, then in trying to log the error message if uses ts->dsi->dev when it is still NULL. Use ts->i2c->dev instead, which is initialised earlier in probe. Fixes: 2f733d6 ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20220415162513.42190-2-stefan.wahren@i2se.com
1 parent f8e6b7b commit f92055a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static void rpi_touchscreen_i2c_write(struct rpi_touchscreen *ts,
229229

230230
ret = i2c_smbus_write_byte_data(ts->i2c, reg, val);
231231
if (ret)
232-
dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret);
232+
dev_err(&ts->i2c->dev, "I2C write failed: %d\n", ret);
233233
}
234234

235235
static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)

0 commit comments

Comments
 (0)