37e1c63efe9c1d60c0e404867bef8839f53d5447
[openwrt/staging/dangole.git] /
1 From d68d26f7f526fce52e71312501f3d07044a3c996 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Wed, 12 Apr 2017 17:52:56 -0700
4 Subject: [PATCH 127/454] panel-raspberrypi-touchscreen: Fix NULL deref if
5 probe order goes wrong.
6
7 If the i2c driver hadn't pobed before the panel driver probes, then
8 the client would be NULL but we were looking for an ERR_PTR in the
9 error case.
10
11 Signed-off-by: Eric Anholt <eric@anholt.net>
12 ---
13 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 3 +++
14 1 file changed, 3 insertions(+)
15
16 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
17 +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
18 @@ -399,6 +399,9 @@ static struct i2c_client *rpi_touchscree
19
20 of_node_put(node);
21
22 + if (!client)
23 + return ERR_PTR(-EPROBE_DEFER);
24 +
25 return client;
26 }
27