Return-Path: Received: from mga06.intel.com ([134.134.136.31]:57017 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759483AbdACQ1w (ORCPT ); Tue, 3 Jan 2017 11:27:52 -0500 From: Mathias Nyman To: Cc: , Pan Bian , , Mathias Nyman Subject: [PATCH 03/11] usb: return error code when platform_get_irq fails Date: Tue, 3 Jan 2017 18:28:45 +0200 Message-Id: <1483460933-15567-4-git-send-email-mathias.nyman@linux.intel.com> In-Reply-To: <1483460933-15567-1-git-send-email-mathias.nyman@linux.intel.com> References: <1483460933-15567-1-git-send-email-mathias.nyman@linux.intel.com> Sender: stable-owner@vger.kernel.org List-ID: From: Pan Bian 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: Signed-off-by: Pan Bian Reviewed-by: Matthias Brugger Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-mtk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 1094ebd..bac961c 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) 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)); -- 1.9.1