Commit 6f12f59a5f0dc014209bcc21d5689a6611e1c1e7
Committed by
David Woodhouse
1 parent
fac0077cc0
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 4 additions and 14 deletions Side-by-side Diff
drivers/mtd/maps/autcpu12-nvram.c
... | ... | @@ -38,7 +38,6 @@ |
38 | 38 | map_word tmp, save0, save1; |
39 | 39 | struct resource *res; |
40 | 40 | struct autcpu12_nvram_priv *priv; |
41 | - int err; | |
42 | 41 | |
43 | 42 | priv = devm_kzalloc(&pdev->dev, |
44 | 43 | sizeof(struct autcpu12_nvram_priv), GFP_KERNEL); |
... | ... | @@ -50,8 +49,7 @@ |
50 | 49 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
51 | 50 | if (!res) { |
52 | 51 | dev_err(&pdev->dev, "failed to get memory resource\n"); |
53 | - err = -ENOENT; | |
54 | - goto out; | |
52 | + return -ENOENT; | |
55 | 53 | } |
56 | 54 | |
57 | 55 | priv->map.bankwidth = 4; |
... | ... | @@ -61,8 +59,7 @@ |
61 | 59 | strcpy((char *)priv->map.name, res->name); |
62 | 60 | if (!priv->map.virt) { |
63 | 61 | dev_err(&pdev->dev, "failed to remap mem resource\n"); |
64 | - err = -EBUSY; | |
65 | - goto out; | |
62 | + return -EBUSY; | |
66 | 63 | } |
67 | 64 | |
68 | 65 | simple_map_init(&priv->map); |
... | ... | @@ -90,8 +87,7 @@ |
90 | 87 | priv->mtd = do_map_probe("map_ram", &priv->map); |
91 | 88 | if (!priv->mtd) { |
92 | 89 | dev_err(&pdev->dev, "probing failed\n"); |
93 | - err = -ENXIO; | |
94 | - goto out; | |
90 | + return -ENXIO; | |
95 | 91 | } |
96 | 92 | |
97 | 93 | priv->mtd->owner = THIS_MODULE; |
... | ... | @@ -106,12 +102,7 @@ |
106 | 102 | |
107 | 103 | map_destroy(priv->mtd); |
108 | 104 | 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; | |
115 | 106 | } |
116 | 107 | |
117 | 108 | static int __devexit autcpu12_nvram_remove(struct platform_device *pdev) |
... | ... | @@ -120,7 +111,6 @@ |
120 | 111 | |
121 | 112 | mtd_device_unregister(priv->mtd); |
122 | 113 | map_destroy(priv->mtd); |
123 | - devm_kfree(&pdev->dev, priv); | |
124 | 114 | |
125 | 115 | return 0; |
126 | 116 | } |