diff options
author | Alexander Beregalov <a.beregalov@gmail.com> | 2011-03-13 14:58:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-14 15:23:34 -0400 |
commit | b4c77848600906055c66dd32074d23858e6e200d (patch) | |
tree | 0b70e3ed6b20da9c6575486420db45803be36228 /drivers/staging | |
parent | 819d4eb11605408e0267301d8853367ff82286a5 (diff) |
staging: crystalhd: fix memory leaks
Free resources before exit.
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/crystalhd/crystalhd_hw.c | 1 | ||||
-rw-r--r-- | drivers/staging/crystalhd/crystalhd_lnx.c | 18 |
2 files changed, 14 insertions, 5 deletions
diff --git a/drivers/staging/crystalhd/crystalhd_hw.c b/drivers/staging/crystalhd/crystalhd_hw.c index 153ddbf4247d..13a514dd0f79 100644 --- a/drivers/staging/crystalhd/crystalhd_hw.c +++ b/drivers/staging/crystalhd/crystalhd_hw.c | |||
@@ -1965,6 +1965,7 @@ enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw) | |||
1965 | } else { | 1965 | } else { |
1966 | BCMLOG_ERR("Insufficient Memory For RX\n"); | 1966 | BCMLOG_ERR("Insufficient Memory For RX\n"); |
1967 | crystalhd_hw_free_dma_rings(hw); | 1967 | crystalhd_hw_free_dma_rings(hw); |
1968 | kfree(rpkt); | ||
1968 | return BC_STS_INSUFF_RES; | 1969 | return BC_STS_INSUFF_RES; |
1969 | } | 1970 | } |
1970 | rpkt->desc_mem.pdma_desc_start = mem; | 1971 | rpkt->desc_mem.pdma_desc_start = mem; |
diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c index c1ee24c98315..7e0c199f6893 100644 --- a/drivers/staging/crystalhd/crystalhd_lnx.c +++ b/drivers/staging/crystalhd/crystalhd_lnx.c | |||
@@ -559,7 +559,7 @@ static int __devinit chd_dec_pci_probe(struct pci_dev *pdev, | |||
559 | rc = pci_enable_device(pdev); | 559 | rc = pci_enable_device(pdev); |
560 | if (rc) { | 560 | if (rc) { |
561 | BCMLOG_ERR("Failed to enable PCI device\n"); | 561 | BCMLOG_ERR("Failed to enable PCI device\n"); |
562 | return rc; | 562 | goto err; |
563 | } | 563 | } |
564 | 564 | ||
565 | snprintf(pinfo->name, sizeof(pinfo->name), "crystalhd_pci_e:%d:%d:%d", | 565 | snprintf(pinfo->name, sizeof(pinfo->name), "crystalhd_pci_e:%d:%d:%d", |
@@ -570,7 +570,8 @@ static int __devinit chd_dec_pci_probe(struct pci_dev *pdev, | |||
570 | if (rc) { | 570 | if (rc) { |
571 | BCMLOG_ERR("Failed to setup memory regions.\n"); | 571 | BCMLOG_ERR("Failed to setup memory regions.\n"); |
572 | pci_disable_device(pdev); | 572 | pci_disable_device(pdev); |
573 | return -ENOMEM; | 573 | rc = -ENOMEM; |
574 | goto err; | ||
574 | } | 575 | } |
575 | 576 | ||
576 | pinfo->present = 1; | 577 | pinfo->present = 1; |
@@ -585,7 +586,8 @@ static int __devinit chd_dec_pci_probe(struct pci_dev *pdev, | |||
585 | if (rc) { | 586 | if (rc) { |
586 | BCMLOG_ERR("_enable_int err:%d\n", rc); | 587 | BCMLOG_ERR("_enable_int err:%d\n", rc); |
587 | pci_disable_device(pdev); | 588 | pci_disable_device(pdev); |
588 | return -ENODEV; | 589 | rc = -ENODEV; |
590 | goto err; | ||
589 | } | 591 | } |
590 | 592 | ||
591 | /* Set dma mask... */ | 593 | /* Set dma mask... */ |
@@ -598,14 +600,16 @@ static int __devinit chd_dec_pci_probe(struct pci_dev *pdev, | |||
598 | } else { | 600 | } else { |
599 | BCMLOG_ERR("Unabled to setup DMA %d\n", rc); | 601 | BCMLOG_ERR("Unabled to setup DMA %d\n", rc); |
600 | pci_disable_device(pdev); | 602 | pci_disable_device(pdev); |
601 | return -ENODEV; | 603 | rc = -ENODEV; |
604 | goto err; | ||
602 | } | 605 | } |
603 | 606 | ||
604 | sts = crystalhd_setup_cmd_context(&pinfo->cmds, pinfo); | 607 | sts = crystalhd_setup_cmd_context(&pinfo->cmds, pinfo); |
605 | if (sts != BC_STS_SUCCESS) { | 608 | if (sts != BC_STS_SUCCESS) { |
606 | BCMLOG_ERR("cmd setup :%d\n", sts); | 609 | BCMLOG_ERR("cmd setup :%d\n", sts); |
607 | pci_disable_device(pdev); | 610 | pci_disable_device(pdev); |
608 | return -ENODEV; | 611 | rc = -ENODEV; |
612 | goto err; | ||
609 | } | 613 | } |
610 | 614 | ||
611 | pci_set_master(pdev); | 615 | pci_set_master(pdev); |
@@ -615,6 +619,10 @@ static int __devinit chd_dec_pci_probe(struct pci_dev *pdev, | |||
615 | g_adp_info = pinfo; | 619 | g_adp_info = pinfo; |
616 | 620 | ||
617 | return 0; | 621 | return 0; |
622 | |||
623 | err: | ||
624 | kfree(pinfo); | ||
625 | return rc; | ||
618 | } | 626 | } |
619 | 627 | ||
620 | #ifdef CONFIG_PM | 628 | #ifdef CONFIG_PM |