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: 9898921 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 618F460230 for ; Mon, 14 Aug 2017 13:18:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5336C23E64 for ; Mon, 14 Aug 2017 13:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47CA12860F; Mon, 14 Aug 2017 13:18:13 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EBEEC23E64 for ; Mon, 14 Aug 2017 13:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/jCPPV4IEZW38UOoRwyah0DMQ499gBoRaH/2ZbI3WjA=; b=V1BbP2ZUTy4dsD 32OUrdJELrkBi7hnvcBs8ivu0QlDP7skSrtT2g9KRnmJtxiTN0iBxQsmQLa4XT9TuDjF7iz46zzSx MMYxWSpMGiP9VUuSidE4GqCWzX3n/9Yl3BYtk1N0lPZQe74KzTiArDPIB53dEOnqBsvfaZTK6tDYv Jj8ssltK4RgFhxE6NoNaoe+dYbwaheJq6HL5LAEFDaRqQ/u8WpF8lgLH81k2IAM2HGgRhmjjzB2yZ isT3js37/lZaZi1CT0WQogTmV2LOZo1k6nE25+GXbHaI64JcKuc6re+bdkGLcB6xiu2ePQeK39Dq9 W2wDGu5OTqnxqcUG7rSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dhFFw-00089C-23; Mon, 14 Aug 2017 13:18:08 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dhFFG-0007PM-QI; Mon, 14 Aug 2017 13:17:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c81Cqyf8tRf8n+9rw9COE/CMdiFmDq+dg7y6NVvX+GU=; b=f8fMhJbZSDgYe2cR5VxLRowKC wWo9tFmV3Y2Ldzbsjg5BVMon9wCkW+fSWn5q0DdvQ92lNpsx/hnYFtAbG6THRb7fcaVkOgg6jPHwQ GcMgCy6fgH5BHjk/2gKp6v/RK6wz5lKZO+UmlprzPiwU0sBquPk8iCWbNgQwfAxoEC56QuBd1udzh FqajEDB9cfJz4gTvsOhPYL6SJAqIitKctH9gRDjhUxgCIkJaZITu6kCXRZs6ooc/klSRjzhYxwVLE Lo8HTh2axYXBc35ZaVTYT1eTt3cy62CSK3FRnJCwv7MYlw+PSPe6ycoBNh9O/HEg5uddRZZY/GDML ZnXLzWeRQ==; Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dhF3Q-0001WM-Jp; Mon, 14 Aug 2017 13:05:14 +0000 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: , , , , , , , , , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170814_140512_957278_CE435E69 X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, hongkun.cao@mediatek.com, sean.wang@mediatek.com, xinping.qian@mediatek.com, honghui.zhang@mediatek.com, yt.shen@mediatek.com, yong.wu@mediatek.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;