diff options
author | Pan Bian <bianpan2016@163.com> | 2017-04-23 07:55:13 +0200 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-05-16 13:11:04 +0200 |
commit | 018047a1dba7636e1f7fdae2cc290a528991d648 (patch) | |
tree | e4e4275636014062a31e542e81c7b1ac03fcf026 /drivers | |
parent | usb: gadget: f_fs: avoid out of bounds access on comp_desc (diff) | |
download | linux-018047a1dba7636e1f7fdae2cc290a528991d648.tar.xz linux-018047a1dba7636e1f7fdae2cc290a528991d648.zip |
usb: dwc3: keystone: check return value
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 <bianpan2016@163.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/dwc3-keystone.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 72664700b8a2..12ee23f53cdd 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -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) { |