aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-10-11 00:41:25 -0400
committerBrian Norris <computersforpeace@gmail.com>2013-11-07 02:32:56 -0500
commit7e3019e364f1b6b9ce123e747addcdc96e8d74ae (patch)
treebc06d080699918542eace8d338faca527f920329 /drivers/mtd
parent994bbd0e91c0dfa4dcda9097b0716607aeec5470 (diff)
mtd: bcm47xxnflash: Use devm_kzalloc
devm_kzalloc is device managed and simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/bcm47xxnflash/main.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
index 2dc3aa632f6c..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)