phy: Fix possible NULL pointer deference
authorVignesh Raghavendra <vigneshr@ti.com>
Wed, 20 May 2020 17:05:41 +0000 (22:35 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 25 May 2020 15:54:53 +0000 (11:54 -0400)
commit64b69f8c89352975c25730bcca4bf8af2296297f
treee71eef532b4a2786c13d2533581bedc3afc5ecf0
parentf4c1f705aa6e686bdb68b7092583be17a7bccebf
phy: Fix possible NULL pointer deference

It is possible that users of generic_phy_*() APIs may pass a valid
struct phy pointer but phy->dev can be NULL, leading to NULL pointer
deference in phy_dev_ops().

So call generic_phy_valid() to verify that phy and phy->dev are both
valid.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
drivers/phy/phy-uclass.c