panel-raspberrypi-touchscreen: Fix NULL deref if probe order goes wrong.
authorEric Anholt <eric@anholt.net>
Thu, 13 Apr 2017 00:52:56 +0000 (17:52 -0700)
committerRaspbian kernel package updater <root@raspbian.org>
Sat, 31 Mar 2018 14:53:29 +0000 (15:53 +0100)
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 <eric@anholt.net>
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c

index 7f315f04b109621ca7f3861fdd8acf956e752629..b57b7ad9aa4c5048186e98553af59ec912973096 100644 (file)
@@ -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;
 }