diff options
Diffstat (limited to 'drivers/mtd/devices/doc2000.c')
-rw-r--r-- | drivers/mtd/devices/doc2000.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index b1cdf6479019..a4eb8b5b85ec 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -562,14 +562,15 @@ void DoC2k_init(struct mtd_info *mtd) | |||
562 | 562 | ||
563 | mtd->type = MTD_NANDFLASH; | 563 | mtd->type = MTD_NANDFLASH; |
564 | mtd->flags = MTD_CAP_NANDFLASH; | 564 | mtd->flags = MTD_CAP_NANDFLASH; |
565 | mtd->writesize = 512; | 565 | mtd->writebufsize = mtd->writesize = 512; |
566 | mtd->oobsize = 16; | 566 | mtd->oobsize = 16; |
567 | mtd->ecc_strength = 2; | ||
567 | mtd->owner = THIS_MODULE; | 568 | mtd->owner = THIS_MODULE; |
568 | mtd->erase = doc_erase; | 569 | mtd->_erase = doc_erase; |
569 | mtd->read = doc_read; | 570 | mtd->_read = doc_read; |
570 | mtd->write = doc_write; | 571 | mtd->_write = doc_write; |
571 | mtd->read_oob = doc_read_oob; | 572 | mtd->_read_oob = doc_read_oob; |
572 | mtd->write_oob = doc_write_oob; | 573 | mtd->_write_oob = doc_write_oob; |
573 | this->curfloor = -1; | 574 | this->curfloor = -1; |
574 | this->curchip = -1; | 575 | this->curchip = -1; |
575 | mutex_init(&this->lock); | 576 | mutex_init(&this->lock); |
@@ -602,13 +603,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
602 | int i, len256 = 0, ret=0; | 603 | int i, len256 = 0, ret=0; |
603 | size_t left = len; | 604 | size_t left = len; |
604 | 605 | ||
605 | /* Don't allow read past end of device */ | ||
606 | if (from >= this->totlen) | ||
607 | return -EINVAL; | ||
608 | |||
609 | mutex_lock(&this->lock); | 606 | mutex_lock(&this->lock); |
610 | |||
611 | *retlen = 0; | ||
612 | while (left) { | 607 | while (left) { |
613 | len = left; | 608 | len = left; |
614 | 609 | ||
@@ -748,13 +743,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
748 | size_t left = len; | 743 | size_t left = len; |
749 | int status; | 744 | int status; |
750 | 745 | ||
751 | /* Don't allow write past end of device */ | ||
752 | if (to >= this->totlen) | ||
753 | return -EINVAL; | ||
754 | |||
755 | mutex_lock(&this->lock); | 746 | mutex_lock(&this->lock); |
756 | |||
757 | *retlen = 0; | ||
758 | while (left) { | 747 | while (left) { |
759 | len = left; | 748 | len = left; |
760 | 749 | ||