diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-31 12:24:00 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-31 12:24:00 -0500 |
commit | 30716e07ef511ec7525c07eb1e8060ba8943c2a2 (patch) | |
tree | eb6a47cae63d3587fa773cc5a16781eaa2c7810b /drivers/mtd/mtdpart.c | |
parent | 03c79cc56e4497cbd09d74a73c1bd0d1d9a8a16c (diff) | |
parent | f56df2f4db6e4af87fb8e941cff69f4501a111df (diff) |
Merge branch 'linus'
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 06a930372b7a..bafd2fba87bd 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -94,7 +94,7 @@ static int part_read_oob(struct mtd_info *mtd, loff_t from, | |||
94 | 94 | ||
95 | if (from >= mtd->size) | 95 | if (from >= mtd->size) |
96 | return -EINVAL; | 96 | return -EINVAL; |
97 | if (from + ops->len > mtd->size) | 97 | if (ops->datbuf && from + ops->len > mtd->size) |
98 | return -EINVAL; | 98 | return -EINVAL; |
99 | res = part->master->read_oob(part->master, from + part->offset, ops); | 99 | res = part->master->read_oob(part->master, from + part->offset, ops); |
100 | 100 | ||
@@ -161,7 +161,7 @@ static int part_write_oob(struct mtd_info *mtd, loff_t to, | |||
161 | 161 | ||
162 | if (to >= mtd->size) | 162 | if (to >= mtd->size) |
163 | return -EINVAL; | 163 | return -EINVAL; |
164 | if (to + ops->len > mtd->size) | 164 | if (ops->datbuf && to + ops->len > mtd->size) |
165 | return -EINVAL; | 165 | return -EINVAL; |
166 | return part->master->write_oob(part->master, to + part->offset, ops); | 166 | return part->master->write_oob(part->master, to + part->offset, ops); |
167 | } | 167 | } |
@@ -323,14 +323,13 @@ int add_mtd_partitions(struct mtd_info *master, | |||
323 | for (i = 0; i < nbparts; i++) { | 323 | for (i = 0; i < nbparts; i++) { |
324 | 324 | ||
325 | /* allocate the partition structure */ | 325 | /* allocate the partition structure */ |
326 | slave = kmalloc (sizeof(*slave), GFP_KERNEL); | 326 | slave = kzalloc (sizeof(*slave), GFP_KERNEL); |
327 | if (!slave) { | 327 | if (!slave) { |
328 | printk ("memory allocation error while creating partitions for \"%s\"\n", | 328 | printk ("memory allocation error while creating partitions for \"%s\"\n", |
329 | master->name); | 329 | master->name); |
330 | del_mtd_partitions(master); | 330 | del_mtd_partitions(master); |
331 | return -ENOMEM; | 331 | return -ENOMEM; |
332 | } | 332 | } |
333 | memset(slave, 0, sizeof(*slave)); | ||
334 | list_add(&slave->list, &mtd_partitions); | 333 | list_add(&slave->list, &mtd_partitions); |
335 | 334 | ||
336 | /* set up the MTD object for this partition */ | 335 | /* set up the MTD object for this partition */ |
@@ -341,6 +340,7 @@ int add_mtd_partitions(struct mtd_info *master, | |||
341 | slave->mtd.oobsize = master->oobsize; | 340 | slave->mtd.oobsize = master->oobsize; |
342 | slave->mtd.ecctype = master->ecctype; | 341 | slave->mtd.ecctype = master->ecctype; |
343 | slave->mtd.eccsize = master->eccsize; | 342 | slave->mtd.eccsize = master->eccsize; |
343 | slave->mtd.subpage_sft = master->subpage_sft; | ||
344 | 344 | ||
345 | slave->mtd.name = parts[i].name; | 345 | slave->mtd.name = parts[i].name; |
346 | slave->mtd.bank_size = master->bank_size; | 346 | slave->mtd.bank_size = master->bank_size; |