phy: fix kernel oops in phy_lookup()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sat, 19 Apr 2014 03:21:43 +0000 (08:51 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Apr 2014 19:53:38 +0000 (12:53 -0700)
commit743bb387a1edbf1ebbba6cf77c1af3e488886c39
treeaf51f66f28ac16b87bd8d4dbe344cfeec4d7905a
parent907aa3aa8dbb5437696776d40caeea245c8ba3bd
phy: fix kernel oops in phy_lookup()

The kernel oopses in phy_lookup() due to 'phy->init_data' being NULL if we
register PHYs from a device tree probing driver and then call phy_get() on a
device that has no representation in the device tree (e.g. a PCI device).
Checking the pointer before dereferening it and skipping an interation if
it's NULL prevents this kernel oops.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/phy/phy-core.c