diff options
-rw-r--r-- | drivers/mtd/nand/socrates_nand.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index f44c7c884a20..e77da7efa200 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c | |||
@@ -149,17 +149,13 @@ static int socrates_nand_probe(struct platform_device *ofdev) | |||
149 | struct mtd_part_parser_data ppdata; | 149 | struct mtd_part_parser_data ppdata; |
150 | 150 | ||
151 | /* Allocate memory for the device structure (and zero it) */ | 151 | /* Allocate memory for the device structure (and zero it) */ |
152 | host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); | 152 | host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); |
153 | if (!host) { | 153 | if (!host) |
154 | printk(KERN_ERR | ||
155 | "socrates_nand: failed to allocate device structure.\n"); | ||
156 | return -ENOMEM; | 154 | return -ENOMEM; |
157 | } | ||
158 | 155 | ||
159 | host->io_base = of_iomap(ofdev->dev.of_node, 0); | 156 | host->io_base = of_iomap(ofdev->dev.of_node, 0); |
160 | if (host->io_base == NULL) { | 157 | if (host->io_base == NULL) { |
161 | printk(KERN_ERR "socrates_nand: ioremap failed\n"); | 158 | printk(KERN_ERR "socrates_nand: ioremap failed\n"); |
162 | kfree(host); | ||
163 | return -EIO; | 159 | return -EIO; |
164 | } | 160 | } |
165 | 161 | ||
@@ -212,7 +208,6 @@ static int socrates_nand_probe(struct platform_device *ofdev) | |||
212 | 208 | ||
213 | out: | 209 | out: |
214 | iounmap(host->io_base); | 210 | iounmap(host->io_base); |
215 | kfree(host); | ||
216 | return res; | 211 | return res; |
217 | } | 212 | } |
218 | 213 | ||
@@ -227,7 +222,6 @@ static int socrates_nand_remove(struct platform_device *ofdev) | |||
227 | nand_release(mtd); | 222 | nand_release(mtd); |
228 | 223 | ||
229 | iounmap(host->io_base); | 224 | iounmap(host->io_base); |
230 | kfree(host); | ||
231 | 225 | ||
232 | return 0; | 226 | return 0; |
233 | } | 227 | } |