mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
EDAC/i10nm: Release mdev/mbase when failing to detect HBM
On systems without HBM (High Bandwidth Memory) mdev/mbase are not
released/unmapped.
Add the code to release mdev/mbase when failing to detect HBM.
[Tony: re-word commit message]
Cc: <stable@vger.kernel.org>
Fixes: c945088384
("EDAC/i10nm: Add support for high bandwidth memory")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20211224091126.1246-1-qiuxu.zhuo@intel.com
This commit is contained in:
parent
c9e6606c7f
commit
c370baa328
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user