aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2010-08-20 03:25:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-24 09:20:39 -0400
commit2aa9be448dab7433c685b634a4049289cb1913d3 (patch)
tree6cd1c0d6f1ec58665c1dc1ec2983177de750940e /drivers/edac
parent848b2f7ed6db4d3a83201187159665cc57725d9f (diff)
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: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index c4fa112271e5..e1cbbbad466e 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -470,6 +470,13 @@ static struct i7core_dev *alloc_i7core_dev(u8 socket,
470 return i7core_dev; 470 return i7core_dev;
471} 471}
472 472
473static void free_i7core_dev(struct i7core_dev *i7core_dev)
474{
475 list_del(&i7core_dev->list);
476 kfree(i7core_dev->pdev);
477 kfree(i7core_dev);
478}
479
473/**************************************************************************** 480/****************************************************************************
474 Memory check routines 481 Memory check routines
475 ****************************************************************************/ 482 ****************************************************************************/
@@ -1265,7 +1272,6 @@ static void i7core_put_devices(struct i7core_dev *i7core_dev)
1265 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); 1272 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
1266 pci_dev_put(pdev); 1273 pci_dev_put(pdev);
1267 } 1274 }
1268 kfree(i7core_dev->pdev);
1269} 1275}
1270 1276
1271static void i7core_put_all_devices(void) 1277static void i7core_put_all_devices(void)
@@ -1274,8 +1280,7 @@ static void i7core_put_all_devices(void)
1274 1280
1275 list_for_each_entry_safe(i7core_dev, tmp, &i7core_edac_list, list) { 1281 list_for_each_entry_safe(i7core_dev, tmp, &i7core_edac_list, list) {
1276 i7core_put_devices(i7core_dev); 1282 i7core_put_devices(i7core_dev);
1277 list_del(&i7core_dev->list); 1283 free_i7core_dev(i7core_dev);
1278 kfree(i7core_dev);
1279 } 1284 }
1280} 1285}
1281 1286
@@ -2106,8 +2111,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
2106 2111
2107 /* Release PCI resources */ 2112 /* Release PCI resources */
2108 i7core_put_devices(i7core_dev); 2113 i7core_put_devices(i7core_dev);
2109 list_del(&i7core_dev->list); 2114 free_i7core_dev(i7core_dev);
2110 kfree(i7core_dev);
2111 } 2115 }
2112 } 2116 }
2113 probed--; 2117 probed--;