Skip to content

Commit

Permalink
usb: phy: phy-mxs-usb: fix a possible NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
LABBE Corentin authored and Felipe Balbi committed Nov 17, 2015
1 parent b9e51b2 commit 89d99ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/usb/phy/phy-mxs-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 89d99ae

Please sign in to comment.