mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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: 92b58b3474 ("phy: ti: introduce phy-gmii-sel driver")
Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
This commit is contained in:
parent
3bd6e94bec
commit
1138a442a0
1 changed files with 2 additions and 2 deletions
|
|
@ -204,11 +204,11 @@ static struct phy *phy_gmii_sel_of_xlate(struct device *dev,
|
|||
|
||||
if (args->args_count < 1)
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (!priv || !priv->if_phys)
|
||||
return ERR_PTR(-ENODEV);
|
||||
if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) &&
|
||||
args->args_count < 2)
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (!priv || !priv->if_phys)
|
||||
return ERR_PTR(-ENODEV);
|
||||
if (phy_id > priv->soc_data->num_ports)
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (phy_id != priv->if_phys[phy_id - 1].id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue