提交 97140df9 编写于 作者: S Srinivas Kandagatla 提交者: Xie XiuQi

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: NGreg KH <gregkh@linuxfoundation.org>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 aa0e0105
...@@ -1326,11 +1326,12 @@ static int of_qcom_slim_ngd_register(struct device *parent, ...@@ -1326,11 +1326,12 @@ static int of_qcom_slim_ngd_register(struct device *parent,
{ {
const struct ngd_reg_offset_data *data; const struct ngd_reg_offset_data *data;
struct qcom_slim_ngd *ngd; struct qcom_slim_ngd *ngd;
const struct of_device_id *match;
struct device_node *node; struct device_node *node;
u32 id; 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) { for_each_available_child_of_node(parent->of_node, node) {
if (of_property_read_u32(node, "reg", &id)) if (of_property_read_u32(node, "reg", &id))
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册