diff options
author | Pan Bian <bianpan2016@163.com> | 2017-01-03 11:28:45 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-03 11:37:32 -0500 |
commit | 28bedb5ae463b9f7e5195cbc93f1795e374bdef8 (patch) | |
tree | 1c8cf2055fb8a766f68759cad4ce6bdbc46177ce | |
parent | 90797aee5d6902b49a453c97d83c326408aeb5a8 (diff) |
usb: return error code when platform_get_irq fails
In function xhci_mtk_probe(), variable ret takes the return value. Its
value should be negative on failures. However, when the call to function
platform_get_irq() fails, it does not set the error code, and 0 will be
returned. 0 indicates no error. As a result, the callers of function
xhci_mtk_probe() will not be able to detect the error. This patch fixes
the bug by assigning the return value of platform_get_irq() to variable
ret if it fails.
CC: <stable@vger.kernel.org>
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/xhci-mtk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 1094ebd2838f..bac961cd24ad 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c | |||
@@ -579,8 +579,10 @@ static int xhci_mtk_probe(struct platform_device *pdev) | |||
579 | goto disable_ldos; | 579 | goto disable_ldos; |
580 | 580 | ||
581 | irq = platform_get_irq(pdev, 0); | 581 | irq = platform_get_irq(pdev, 0); |
582 | if (irq < 0) | 582 | if (irq < 0) { |
583 | ret = irq; | ||
583 | goto disable_clk; | 584 | goto disable_clk; |
585 | } | ||
584 | 586 | ||
585 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ | 587 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ |
586 | ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); | 588 | ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); |