phy: fix kernel oops in phy_lookup()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sat, 19 Apr 2014 03:21:43 +0000 (08:51 +0530)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:47:46 +0000 (11:47 +0900)
commit43cde2eea8bc838ce3d134e157b3a280cbbe2043
treeef7c28931a2fa6e9a07ed85d4fea9c550ca3f28c
parent1a57003c4ad35314a4e2b6cef665746fa927230b
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