aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/bcm47xxnflash
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/bcm47xxnflash')
-rw-r--r--drivers/mtd/nand/bcm47xxnflash/main.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
index 7bae569fdc79..107445911315 100644
--- a/drivers/mtd/nand/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/bcm47xxnflash/main.c
@@ -29,11 +29,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
29 struct bcm47xxnflash *b47n; 29 struct bcm47xxnflash *b47n;
30 int err = 0; 30 int err = 0;
31 31
32 b47n = kzalloc(sizeof(*b47n), GFP_KERNEL); 32 b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
33 if (!b47n) { 33 if (!b47n)
34 err = -ENOMEM; 34 return -ENOMEM;
35 goto out;
36 }
37 35
38 b47n->nand_chip.priv = b47n; 36 b47n->nand_chip.priv = b47n;
39 b47n->mtd.owner = THIS_MODULE; 37 b47n->mtd.owner = THIS_MODULE;
@@ -48,22 +46,16 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
48 } 46 }
49 if (err) { 47 if (err) {
50 pr_err("Initialization failed: %d\n", err); 48 pr_err("Initialization failed: %d\n", err);
51 goto err_init; 49 return err;
52 } 50 }
53 51
54 err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0); 52 err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
55 if (err) { 53 if (err) {
56 pr_err("Failed to register MTD device: %d\n", err); 54 pr_err("Failed to register MTD device: %d\n", err);
57 goto err_dev_reg; 55 return err;
58 } 56 }
59 57
60 return 0; 58 return 0;
61
62err_dev_reg:
63err_init:
64 kfree(b47n);
65out:
66 return err;
67} 59}
68 60
69static int bcm47xxnflash_remove(struct platform_device *pdev) 61static int bcm47xxnflash_remove(struct platform_device *pdev)
@@ -85,22 +77,4 @@ static struct platform_driver bcm47xxnflash_driver = {
85 }, 77 },
86}; 78};
87 79
88static int __init bcm47xxnflash_init(void) 80module_platform_driver(bcm47xxnflash_driver);
89{
90 int err;
91
92 err = platform_driver_register(&bcm47xxnflash_driver);
93 if (err)
94 pr_err("Failed to register bcm47xx nand flash driver: %d\n",
95 err);
96
97 return err;
98}
99
100static void __exit bcm47xxnflash_exit(void)
101{
102 platform_driver_unregister(&bcm47xxnflash_driver);
103}
104
105module_init(bcm47xxnflash_init);
106module_exit(bcm47xxnflash_exit);