Skip to content

Commit 6f12f59

Browse files
JuliaLawallDavid Woodhouse
authored andcommitted
mtd: autcpu12-nvram: drop frees of devm_ alloc'd data
devm free functions should not have to be explicitly used. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent fac0077 commit 6f12f59

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drivers/mtd/maps/autcpu12-nvram.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static int __devinit autcpu12_nvram_probe(struct platform_device *pdev)
3838
map_word tmp, save0, save1;
3939
struct resource *res;
4040
struct autcpu12_nvram_priv *priv;
41-
int err;
4241

4342
priv = devm_kzalloc(&pdev->dev,
4443
sizeof(struct autcpu12_nvram_priv), GFP_KERNEL);
@@ -50,8 +49,7 @@ static int __devinit autcpu12_nvram_probe(struct platform_device *pdev)
5049
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5150
if (!res) {
5251
dev_err(&pdev->dev, "failed to get memory resource\n");
53-
err = -ENOENT;
54-
goto out;
52+
return -ENOENT;
5553
}
5654

5755
priv->map.bankwidth = 4;
@@ -61,8 +59,7 @@ static int __devinit autcpu12_nvram_probe(struct platform_device *pdev)
6159
strcpy((char *)priv->map.name, res->name);
6260
if (!priv->map.virt) {
6361
dev_err(&pdev->dev, "failed to remap mem resource\n");
64-
err = -EBUSY;
65-
goto out;
62+
return -EBUSY;
6663
}
6764

6865
simple_map_init(&priv->map);
@@ -90,8 +87,7 @@ static int __devinit autcpu12_nvram_probe(struct platform_device *pdev)
9087
priv->mtd = do_map_probe("map_ram", &priv->map);
9188
if (!priv->mtd) {
9289
dev_err(&pdev->dev, "probing failed\n");
93-
err = -ENXIO;
94-
goto out;
90+
return -ENXIO;
9591
}
9692

9793
priv->mtd->owner = THIS_MODULE;
@@ -106,12 +102,7 @@ static int __devinit autcpu12_nvram_probe(struct platform_device *pdev)
106102

107103
map_destroy(priv->mtd);
108104
dev_err(&pdev->dev, "NV-RAM device addition failed\n");
109-
err = -ENOMEM;
110-
111-
out:
112-
devm_kfree(&pdev->dev, priv);
113-
114-
return err;
105+
return -ENOMEM;
115106
}
116107

117108
static int __devexit autcpu12_nvram_remove(struct platform_device *pdev)
@@ -120,7 +111,6 @@ static int __devexit autcpu12_nvram_remove(struct platform_device *pdev)
120111

121112
mtd_device_unregister(priv->mtd);
122113
map_destroy(priv->mtd);
123-
devm_kfree(&pdev->dev, priv);
124114

125115
return 0;
126116
}

0 commit comments

Comments
 (0)