summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-11-12 12:25:25 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 08:51:54 +0100
commitd7e82b903dbd5f0295dad4a807ae1faf4ed5461e (patch)
treeddd16060578181d3fe94d263ce53f6d871926b80
parent0c40b942f6a99f2ade4d43ed5186bbba1c88d9f6 (diff)
downloadlinux-stable-d7e82b903dbd5f0295dad4a807ae1faf4ed5461e.tar.gz
linux-stable-d7e82b903dbd5f0295dad4a807ae1faf4ed5461e.tar.bz2
linux-stable-d7e82b903dbd5f0295dad4a807ae1faf4ed5461e.zip
slimbus: ngd: Fix build error on x86
[ Upstream commit 458a445deb9c9fb13cec46fe9b179a84d2ff514f ] on non DT platforms like x86 of_match_node is set to NULL, dereferencing directly would throw an error. Fix this by doing this in two steps, get the match then the data. Reported-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/slimbus/qcom-ngd-ctrl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index d72f8eed2e8b..9221ba7b7863 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1326,11 +1326,12 @@ static int of_qcom_slim_ngd_register(struct device *parent,
{
const struct ngd_reg_offset_data *data;
struct qcom_slim_ngd *ngd;
+ const struct of_device_id *match;
struct device_node *node;
u32 id;
- data = of_match_node(qcom_slim_ngd_dt_match, parent->of_node)->data;
-
+ match = of_match_node(qcom_slim_ngd_dt_match, parent->of_node);
+ data = match->data;
for_each_available_child_of_node(parent->of_node, node) {
if (of_property_read_u32(node, "reg", &id))
continue;