From: Eric Anholt Date: Thu, 13 Apr 2017 00:52:56 +0000 (-0700) Subject: panel-raspberrypi-touchscreen: Fix NULL deref if probe order goes wrong. X-Git-Tag: archive/raspbian/4.9.51-1+rpi1~5^2~303 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7df9fc3fbedacbb97b8959169c73268dfd0c4d7a;p=linux-4.9.git panel-raspberrypi-touchscreen: Fix NULL deref if probe order goes wrong. If the i2c driver hadn't pobed before the panel driver probes, then the client would be NULL but we were looking for an ERR_PTR in the error case. Signed-off-by: Eric Anholt --- diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c index 7f315f04b109..b57b7ad9aa4c 100644 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c @@ -404,6 +404,9 @@ static struct i2c_client *rpi_touchscreen_get_i2c(struct device *dev, of_node_put(node); + if (!client) + return ERR_PTR(-EPROBE_DEFER); + return client; }