aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/bf5xx_nand.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index b7a24946ca26..722898aea7a6 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -679,9 +679,6 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
679 peripheral_free_list(bfin_nfc_pin_req); 679 peripheral_free_list(bfin_nfc_pin_req);
680 bf5xx_nand_dma_remove(info); 680 bf5xx_nand_dma_remove(info);
681 681
682 /* free the common resources */
683 kfree(info);
684
685 return 0; 682 return 0;
686} 683}
687 684
@@ -742,10 +739,10 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
742 return -EFAULT; 739 return -EFAULT;
743 } 740 }
744 741
745 info = kzalloc(sizeof(*info), GFP_KERNEL); 742 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
746 if (info == NULL) { 743 if (info == NULL) {
747 err = -ENOMEM; 744 err = -ENOMEM;
748 goto out_err_kzalloc; 745 goto out_err;
749 } 746 }
750 747
751 platform_set_drvdata(pdev, info); 748 platform_set_drvdata(pdev, info);
@@ -790,7 +787,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
790 /* initialise the hardware */ 787 /* initialise the hardware */
791 err = bf5xx_nand_hw_init(info); 788 err = bf5xx_nand_hw_init(info);
792 if (err) 789 if (err)
793 goto out_err_hw_init; 790 goto out_err;
794 791
795 /* setup hardware ECC data struct */ 792 /* setup hardware ECC data struct */
796 if (hardware_ecc) { 793 if (hardware_ecc) {
@@ -827,9 +824,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
827 824
828out_err_nand_scan: 825out_err_nand_scan:
829 bf5xx_nand_dma_remove(info); 826 bf5xx_nand_dma_remove(info);
830out_err_hw_init: 827out_err:
831 kfree(info);
832out_err_kzalloc:
833 peripheral_free_list(bfin_nfc_pin_req); 828 peripheral_free_list(bfin_nfc_pin_req);
834 829
835 return err; 830 return err;