Skip to content

Commit

Permalink
usb: return error code when platform_get_irq fails
Browse files Browse the repository at this point in the history
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: <[email protected]>
Signed-off-by: Pan Bian <[email protected]>
Reviewed-by: Matthias Brugger <[email protected]>
Signed-off-by: Mathias Nyman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
SinkFinder authored and gregkh committed Jan 3, 2017
1 parent 90797ae commit 28bedb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/host/xhci-mtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
goto disable_ldos;

irq = platform_get_irq(pdev, 0);
if (irq < 0)
if (irq < 0) {
ret = irq;
goto disable_clk;
}

/* Initialize dma_mask and coherent_dma_mask to 32-bits */
ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
Expand Down

0 comments on commit 28bedb5

Please sign in to comment.