diff options
author | LABBE Corentin <clabbe.montjoie@gmail.com> | 2015-11-12 08:45:52 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-11-17 11:35:48 -0600 |
commit | 89d99aea94a5bf8eae530cd77df40904d382946c (patch) | |
tree | c5aff6debc0b48739d851c1fc7f3120e29ea5d76 | |
parent | b9e51b2b1fda19143f48d182ed7a2943f21e1ae4 (diff) | |
download | linux-stable-89d99aea94a5bf8eae530cd77df40904d382946c.tar.gz linux-stable-89d99aea94a5bf8eae530cd77df40904d382946c.tar.bz2 linux-stable-89d99aea94a5bf8eae530cd77df40904d382946c.zip |
usb: phy: phy-mxs-usb: fix a possible NULL dereference
of_match_device could return NULL, and so cause a NULL pointer
dereference later.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/phy/phy-mxs-usb.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 4d863ebc117c..b7536af777ab 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -452,10 +452,13 @@ static int mxs_phy_probe(struct platform_device *pdev) struct clk *clk; struct mxs_phy *mxs_phy; int ret; - const struct of_device_id *of_id = - of_match_device(mxs_phy_dt_ids, &pdev->dev); + const struct of_device_id *of_id; struct device_node *np = pdev->dev.of_node; + of_id = of_match_device(mxs_phy_dt_ids, &pdev->dev); + if (!of_id) + return -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(base)) |