summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wct4xxp/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dahdi/wct4xxp/base.c')
-rw-r--r--drivers/dahdi/wct4xxp/base.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index 6558de8..d3dcdda 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -3807,6 +3807,7 @@ static void __devexit t4_remove_one(struct pci_dev *pdev)
{
struct t4 *wc = pci_get_drvdata(pdev);
struct dahdi_span *span;
+ int basesize;
int i;
if (!wc) {
@@ -3822,6 +3823,10 @@ static void __devexit t4_remove_one(struct pci_dev *pdev)
wc->vpm450m = NULL;
/* Unregister spans */
+ basesize = DAHDI_MAX_CHUNKSIZE * 32 * 4;
+ if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN))
+ basesize = basesize * 2;
+
for (i = 0; i < wc->numspans; ++i) {
span = &wc->tspans[i]->span;
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags))
@@ -3842,7 +3847,9 @@ static void __devexit t4_remove_one(struct pci_dev *pdev)
pci_release_regions(pdev);
/* Immediately free resources */
- pci_free_consistent(pdev, DAHDI_MAX_CHUNKSIZE * 2 * 2 * 32 * 4, (void *)wc->writechunk, wc->writedma);
+
+ pci_free_consistent(pdev, basesize * 2,
+ (void *)wc->writechunk, wc->writedma);
order_index[wc->order]--;