From patchwork Mon Aug 14 13:04:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honghui Zhang X-Patchwork-Id: 9898893 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 945D1602BA for ; Mon, 14 Aug 2017 13:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8490528606 for ; Mon, 14 Aug 2017 13:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 794902860F; Mon, 14 Aug 2017 13:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 179FD28606 for ; Mon, 14 Aug 2017 13:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250AbdHNNEn (ORCPT ); Mon, 14 Aug 2017 09:04:43 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:55111 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752318AbdHNNEm (ORCPT ); Mon, 14 Aug 2017 09:04:42 -0400 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1251818805; Mon, 14 Aug 2017 21:04:37 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 14 Aug 2017 21:04:36 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 14 Aug 2017 21:04:35 +0800 From: To: , , , , , , , , , CC: , , , , , , Subject: [PATCH v2 1/3] PCI: mediatek: Fix return value in case of error Date: Mon, 14 Aug 2017 21:04:26 +0800 Message-ID: <1502715868-17651-2-git-send-email-honghui.zhang@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1502715868-17651-1-git-send-email-honghui.zhang@mediatek.com> References: <1502715868-17651-1-git-send-email-honghui.zhang@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honghui Zhang In commit ae02a6dda285 ("PCI: mediatek: Add controller support for MT2712 and MT7622"), the function 'mtk_pcie_init_irq_domain', the pattern used to check and return error is: if (!var) { dev_err(...); return PTR_ERR(var); } The return value in such case is always 0, change it to return -ENODEV instead. And if error was returned from this function, the error should be returned to upper layer instead of -ENODEV. Signed-off-by: Honghui Zhang --- drivers/pci/host/pcie-mediatek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c index 44e7885..946c056 100644 --- a/drivers/pci/host/pcie-mediatek.c +++ b/drivers/pci/host/pcie-mediatek.c @@ -450,14 +450,14 @@ static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port, pcie_intc_node = of_get_next_child(node, NULL); if (!pcie_intc_node) { dev_err(dev, "no PCIe Intc node found\n"); - return PTR_ERR(pcie_intc_node); + return -ENODEV; } port->irq_domain = irq_domain_add_linear(pcie_intc_node, INTX_NUM, &intx_domain_ops, port); if (!port->irq_domain) { dev_err(dev, "failed to get INTx IRQ domain\n"); - return PTR_ERR(port->irq_domain); + return -ENODEV; } return 0; @@ -502,7 +502,7 @@ static int mtk_pcie_setup_irq(struct mtk_pcie_port *port, err = mtk_pcie_init_irq_domain(port, node); if (err) { dev_err(dev, "failed to init PCIe legacy IRQ domain\n"); - return -ENODEV; + return err; } return 0;