Skip to content

Commit fd05657

Browse files
Dan Carpentergregkh
authored andcommitted
phy: ti: gmii-sel: check of_get_address() for failure
[ Upstream commit 8d55027 ] Smatch complains that if of_get_address() returns NULL, then "size" isn't initialized. Also it would lead to an Oops. Fixes: 7f78322 ("phy: ti: gmii-sel: retrieve ports number and base offset from dt") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Link: https://lore.kernel.org/r/20210914110038.GB11657@kili Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0a46740 commit fd05657

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/phy/ti/phy-gmii-sel.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
320320
u64 size;
321321

322322
offset = of_get_address(dev->of_node, 0, &size, NULL);
323+
if (!offset)
324+
return -EINVAL;
323325
priv->num_ports = size / sizeof(u32);
324326
if (!priv->num_ports)
325327
return -EINVAL;

0 commit comments

Comments
 (0)