Skip to content

Commit

Permalink
usb: dwc3: keystone: check return value
Browse files Browse the repository at this point in the history
[ Upstream commit 018047a ]

Function devm_clk_get() returns an ERR_PTR when it fails. However, in
function kdwc3_probe(), its return value is not checked, which may
result in a bad memory access bug. This patch fixes the bug.

Signed-off-by: Pan Bian <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
SinkFinder authored and gregkh committed Apr 13, 2018
1 parent afeabec commit 04030f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/dwc3/dwc3-keystone.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ static int kdwc3_probe(struct platform_device *pdev)
return PTR_ERR(kdwc->usbss);

kdwc->clk = devm_clk_get(kdwc->dev, "usb");
if (IS_ERR(kdwc->clk)) {
dev_err(kdwc->dev, "unable to get usb clock\n");
return PTR_ERR(kdwc->clk);
}

error = clk_prepare_enable(kdwc->clk);
if (error < 0) {
Expand Down

0 comments on commit 04030f5

Please sign in to comment.