Commit 2aa9be44 authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Mauro Carvalho Chehab

i7core_edac: Introduce free_i7core_dev

Have a method to make a couple with alloc_i7core_dev() previously
introduced.  Using in pair will help proper resource handling.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 848b2f7e
...@@ -470,6 +470,13 @@ static struct i7core_dev *alloc_i7core_dev(u8 socket, ...@@ -470,6 +470,13 @@ static struct i7core_dev *alloc_i7core_dev(u8 socket,
return i7core_dev; return i7core_dev;
} }
static void free_i7core_dev(struct i7core_dev *i7core_dev)
{
list_del(&i7core_dev->list);
kfree(i7core_dev->pdev);
kfree(i7core_dev);
}
/**************************************************************************** /****************************************************************************
Memory check routines Memory check routines
****************************************************************************/ ****************************************************************************/
...@@ -1265,7 +1272,6 @@ static void i7core_put_devices(struct i7core_dev *i7core_dev) ...@@ -1265,7 +1272,6 @@ static void i7core_put_devices(struct i7core_dev *i7core_dev)
PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
pci_dev_put(pdev); pci_dev_put(pdev);
} }
kfree(i7core_dev->pdev);
} }
static void i7core_put_all_devices(void) static void i7core_put_all_devices(void)
...@@ -1274,8 +1280,7 @@ static void i7core_put_all_devices(void) ...@@ -1274,8 +1280,7 @@ static void i7core_put_all_devices(void)
list_for_each_entry_safe(i7core_dev, tmp, &i7core_edac_list, list) { list_for_each_entry_safe(i7core_dev, tmp, &i7core_edac_list, list) {
i7core_put_devices(i7core_dev); i7core_put_devices(i7core_dev);
list_del(&i7core_dev->list); free_i7core_dev(i7core_dev);
kfree(i7core_dev);
} }
} }
...@@ -2106,8 +2111,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev) ...@@ -2106,8 +2111,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
/* Release PCI resources */ /* Release PCI resources */
i7core_put_devices(i7core_dev); i7core_put_devices(i7core_dev);
list_del(&i7core_dev->list); free_i7core_dev(i7core_dev);
kfree(i7core_dev);
} }
} }
probed--; probed--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment