aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/ti
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-12-22 06:56:53 -0500
committerKishon Vijay Abraham I <kishon@ti.com>2019-01-16 07:30:54 -0500
commit1138a442a0c5e97594ec63e898098b0c9e781172 (patch)
tree7db3d876d079b8491210f585c93de5948d368bb3 /drivers/phy/ti
parent3bd6e94bec122a951d462c239b47954cf5f36e33 (diff)
phy: ti: ensure priv is not null before dereferencing it
Currently priv is being dereferenced before priv is being null checked. Fix this by moving the null check on priv before the dereference. Detected by CoverityScan, CID#1476018 ("Dereference before null check") Fixes: 92b58b34741f ("phy: ti: introduce phy-gmii-sel driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/ti')
-rw-r--r--drivers/phy/ti/phy-gmii-sel.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
index 77fdaa551977..a52c5bb35033 100644
--- a/drivers/phy/ti/phy-gmii-sel.c
+++ b/drivers/phy/ti/phy-gmii-sel.c
@@ -204,11 +204,11 @@ static struct phy *phy_gmii_sel_of_xlate(struct device *dev,
204 204
205 if (args->args_count < 1) 205 if (args->args_count < 1)
206 return ERR_PTR(-EINVAL); 206 return ERR_PTR(-EINVAL);
207 if (!priv || !priv->if_phys)
208 return ERR_PTR(-ENODEV);
207 if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) && 209 if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) &&
208 args->args_count < 2) 210 args->args_count < 2)
209 return ERR_PTR(-EINVAL); 211 return ERR_PTR(-EINVAL);
210 if (!priv || !priv->if_phys)
211 return ERR_PTR(-ENODEV);
212 if (phy_id > priv->soc_data->num_ports) 212 if (phy_id > priv->soc_data->num_ports)
213 return ERR_PTR(-EINVAL); 213 return ERR_PTR(-EINVAL);
214 if (phy_id != priv->if_phys[phy_id - 1].id) 214 if (phy_id != priv->if_phys[phy_id - 1].id)