From: Ryder Lee <ryder.lee@mediatek.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, <linux-mediatek@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>
Subject: [PATCH] PCI: mediatek: fix error handling in mtk_pcie_parse_and_add_res()
Date: Mon, 5 Jun 2017 14:27:58 +0800 [thread overview]
Message-ID: <1496644078-27122-1-git-send-email-ryder.lee@mediatek.com> (raw)
The 'linkup' variable would always increment by one whether the link
status is true or not. Therefore, this patch fixes the return value in
mtk_pcie_parse_and_add_res() and removes unnecessary 'linkup' variable.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
drivers/pci/host/pcie-mediatek.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c
index 8ec8fa8..3baafa8 100644
--- a/drivers/pci/host/pcie-mediatek.c
+++ b/drivers/pci/host/pcie-mediatek.c
@@ -373,7 +373,7 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
struct of_pci_range_parser parser;
struct of_pci_range range;
struct resource res;
- int err, linkup = 0;
+ int err;
/* parse shared resources */
err = mtk_pcie_handle_shared_resource(pcie);
@@ -444,11 +444,11 @@ static int mtk_pcie_parse_and_add_res(struct mtk_pcie *pcie)
/* enable each port, and then check link status */
err = mtk_pcie_enable_ports(port);
- if (!err)
- linkup++;
+ if (err)
+ return err;
}
- return !linkup;
+ return 0;
}
static int mtk_pcie_request_resources(struct mtk_pcie *pcie)
--
1.9.1
next reply other threads:[~2017-06-05 6:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 6:27 Ryder Lee [this message]
2017-06-15 21:11 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496644078-27122-1-git-send-email-ryder.lee@mediatek.com \
--to=ryder.lee@mediatek.com \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®