[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211224091126.1246-1-qiuxu.zhuo@intel.com>
Date: Fri, 24 Dec 2021 04:11:26 -0500
From: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
To: "Luck, Tony" <tony.luck@...el.com>
Cc: Qiuxu Zhuo <qiuxu.zhuo@...el.com>, Borislav Petkov <bp@...en8.de>,
Dan Carpenter <dan.carpenter@...cle.com>,
linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] EDAC/i10nm: Release mdev/mbase when failing to detect HBM
Commit in Fixes doesn't release mdev/mbase when failing to detect
HBM. Add the code to release mdev/mbase when failing to detect HBM.
Fixes: c945088384d0 ("EDAC/i10nm: Add support for high bandwidth memory")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
---
drivers/edac/i10nm_base.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c
index 83345bfac246..6cf50ee0b77c 100644
--- a/drivers/edac/i10nm_base.c
+++ b/drivers/edac/i10nm_base.c
@@ -358,6 +358,9 @@ static int i10nm_get_hbm_munits(void)
mbase = ioremap(base + off, I10NM_HBM_IMC_MMIO_SIZE);
if (!mbase) {
+ pci_dev_put(d->imc[lmc].mdev);
+ d->imc[lmc].mdev = NULL;
+
i10nm_printk(KERN_ERR, "Failed to ioremap for hbm mc 0x%llx\n",
base + off);
return -ENOMEM;
@@ -368,6 +371,12 @@ static int i10nm_get_hbm_munits(void)
mcmtr = I10NM_GET_MCMTR(&d->imc[lmc], 0);
if (!I10NM_IS_HBM_IMC(mcmtr)) {
+ iounmap(d->imc[lmc].mbase);
+ d->imc[lmc].mbase = NULL;
+ d->imc[lmc].hbm_mc = false;
+ pci_dev_put(d->imc[lmc].mdev);
+ d->imc[lmc].mdev = NULL;
+
i10nm_printk(KERN_ERR, "This isn't an hbm mc!\n");
return -ENODEV;
}
--
2.17.1
Powered by blists - more mailing lists