From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: sam@ravnborg.org
Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu,
secalert@redhat.com, Navid Emamdoost <navid.emamdoost@gmail.com>,
Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/panel: check failure cases in the probe func
Date: Wed, 24 Jul 2019 09:48:44 -0500 [thread overview]
Message-ID: <20190724144845.4791-1-navid.emamdoost@gmail.com> (raw)
In-Reply-To: <20190724051700.GA22730@ravnborg.org>
The following function calls may fail and return NULL, so the null check
is added.
of_graph_get_next_endpoint
of_graph_get_remote_port_parent
of_graph_get_remote_port
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 28c0620dfe0f..9484fdb60f68 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -399,7 +399,13 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
/* Look up the DSI host. It needs to probe before we do. */
endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
+ if (!endpoint)
+ return -ENODEV;
+
dsi_host_node = of_graph_get_remote_port_parent(endpoint);
+ if (!dsi_host_node)
+ return -ENODEV;
+
host = of_find_mipi_dsi_host_by_node(dsi_host_node);
of_node_put(dsi_host_node);
if (!host) {
@@ -408,6 +414,9 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
}
info.node = of_graph_get_remote_port(endpoint);
+ if (!info.node)
+ return -ENODEV;
+
of_node_put(endpoint);
ts->dsi = mipi_dsi_device_register_full(host, &info);
--
2.17.1
next prev parent reply other threads:[~2019-07-24 14:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-24 2:56 [PATCH] rpi_touchscreen_probe: check for failure case Navid Emamdoost
2019-07-24 5:17 ` Sam Ravnborg
2019-07-24 14:48 ` Navid Emamdoost [this message]
2019-07-24 18:59 ` [PATCH] drm/panel: check failure cases in the probe func Sam Ravnborg
2019-07-24 19:55 ` [PATCH v2] " Navid Emamdoost
2019-07-26 12:33 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190724144845.4791-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=secalert@redhat.com \
--cc=smccaman@umn.edu \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome