diff options
author | LABBE Corentin <clabbe.montjoie@gmail.com> | 2015-11-12 02:45:52 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-11-17 12:35:48 -0500 |
commit | 89d99aea94a5bf8eae530cd77df40904d382946c (patch) | |
tree | c5aff6debc0b48739d851c1fc7f3120e29ea5d76 | |
parent | b9e51b2b1fda19143f48d182ed7a2943f21e1ae4 (diff) |
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) | |||
452 | struct clk *clk; | 452 | struct clk *clk; |
453 | struct mxs_phy *mxs_phy; | 453 | struct mxs_phy *mxs_phy; |
454 | int ret; | 454 | int ret; |
455 | const struct of_device_id *of_id = | 455 | const struct of_device_id *of_id; |
456 | of_match_device(mxs_phy_dt_ids, &pdev->dev); | ||
457 | struct device_node *np = pdev->dev.of_node; | 456 | struct device_node *np = pdev->dev.of_node; |
458 | 457 | ||
458 | of_id = of_match_device(mxs_phy_dt_ids, &pdev->dev); | ||
459 | if (!of_id) | ||
460 | return -ENODEV; | ||
461 | |||
459 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
460 | base = devm_ioremap_resource(&pdev->dev, res); | 463 | base = devm_ioremap_resource(&pdev->dev, res); |
461 | if (IS_ERR(base)) | 464 | if (IS_ERR(base)) |