projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
52bc51c
)
mtd: rawnand: nandsim: Free the allocated device on error in ns_init()
author
Miquel Raynal
<miquel.raynal@bootlin.com>
Mon, 25 May 2020 08:58:43 +0000
(10:58 +0200)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Sun, 31 May 2020 08:53:38 +0000
(10:53 +0200)
The nandsim device is allocated and initialized inside ns_init() by a
call to ns_alloc_device(), free it on error.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link:
https://lore.kernel.org/linux-mtd/20200525085851.17682-10-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/nandsim.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/nand/raw/nandsim.c
b/drivers/mtd/nand/raw/nandsim.c
index
53889bc
..
d6e16dd
100644
(file)
--- a/
drivers/mtd/nand/raw/nandsim.c
+++ b/
drivers/mtd/nand/raw/nandsim.c
@@
-766,12
+766,14
@@
static int __init ns_init(struct mtd_info *mtd)
NS_ERR("init_nandsim: unable to allocate %u bytes for the internal buffer\n",
ns->geom.pgszoob);
ret = -ENOMEM;
- goto free_
partition_names
;
+ goto free_
device
;
}
memset(ns->buf.byte, 0xFF, ns->geom.pgszoob);
return 0;
+free_device:
+ ns_free_device(ns);
free_partition_names:
for (i = 0; i < ARRAY_SIZE(ns->partitions); ++i)
kfree(ns->partitions[i].name);