提交 8d55027f 编写于 作者: D Dan Carpenter 提交者: Vinod Koul

phy: ti: gmii-sel: check of_get_address() for failure

Smatch complains that if of_get_address() returns NULL, then "size"
isn't initialized.  Also it would lead to an Oops.

Fixes: 7f78322c ("phy: ti: gmii-sel: retrieve ports number and base offset from dt")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NGrygorii Strashko <grygorii.strashko@ti.com>
Link: https://lore.kernel.org/r/20210914110038.GB11657@kiliSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 d8b951ab
......@@ -320,6 +320,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
u64 size;
offset = of_get_address(dev->of_node, 0, &size, NULL);
if (!offset)
return -EINVAL;
priv->num_ports = size / sizeof(u32);
if (!priv->num_ports)
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册