phy: fix kernel oops in phy_lookup()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sat, 19 Apr 2014 03:21:43 +0000 (08:51 +0530)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 15 May 2014 05:29:22 +0000 (07:29 +0200)
commit7298da39ff7970fd057a6f9dafe143a330018686
treeb1ccfa6616fb479493d9900b99773fb9c6a6de2e
parentb084cf75d1721bd4230ce56a87688a5ef3eda569
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>
[backport from upstream commit 743bb387a1edbf1ebbba6cf77c1af3e488886c39]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Iea16343af63965d19960fc8acf89e0a65b806440
drivers/phy/phy-core.c