提交 d9350f21 编写于 作者: A Aditya Pakki 提交者: Sudeep Holla

firmware: arm_scmi: replace of_match_device->data with of_device_get_match_data()

of_match_device can return NULL if no matching device is found though
it's highly unlikely to happen in scmi_probe as it's called only if
a valid match is found.

However we can use of_device_get_match_data() instead of
of_match_device()->data to handle NULL pointer checks and return -EINVAL
in such a scenario.
Reviewed-by: NSteven Price <steven.price@arm.com>
Signed-off-by: NAditya Pakki <pakki001@umn.edu>
Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
上级 fa7fe29a
......@@ -796,7 +796,9 @@ static int scmi_probe(struct platform_device *pdev)
return -EINVAL;
}
desc = of_match_device(scmi_of_match, dev)->data;
desc = of_device_get_match_data(dev);
if (!desc)
return -EINVAL;
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
if (!info)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册