Skip to content

Commit

Permalink
mtd: doc: do not initialize mtd_info fields to 0 or NULL
Browse files Browse the repository at this point in the history
The 'struct mtd_info' object is allocated with 'kzalloc()', so it
contains only zeroes - no need to initialize various fields to 0 or
NULL.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent 122f81d commit bea7fe0
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
9 changes: 0 additions & 9 deletions drivers/mtd/devices/doc2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,23 +562,14 @@ void DoC2k_init(struct mtd_info *mtd)

mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->size = 0;
mtd->erasesize = 0;
mtd->writesize = 512;
mtd->oobsize = 16;
mtd->owner = THIS_MODULE;
mtd->erase = doc_erase;
mtd->point = NULL;
mtd->unpoint = NULL;
mtd->read = doc_read;
mtd->write = doc_write;
mtd->read_oob = doc_read_oob;
mtd->write_oob = doc_write_oob;
mtd->sync = NULL;

this->totlen = 0;
this->numchips = 0;

this->curfloor = -1;
this->curchip = -1;
mutex_init(&this->lock);
Expand Down
8 changes: 0 additions & 8 deletions drivers/mtd/devices/doc2001.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,17 @@ void DoCMil_init(struct mtd_info *mtd)

mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->size = 0;

/* FIXME: erase size is not always 8KiB */
mtd->erasesize = 0x2000;

mtd->writesize = 512;
mtd->oobsize = 16;
mtd->owner = THIS_MODULE;
mtd->erase = doc_erase;
mtd->point = NULL;
mtd->unpoint = NULL;
mtd->read = doc_read;
mtd->write = doc_write;
mtd->read_oob = doc_read_oob;
mtd->write_oob = doc_write_oob;
mtd->sync = NULL;

this->totlen = 0;
this->numchips = 0;
this->curfloor = -1;
this->curchip = -1;

Expand Down
9 changes: 0 additions & 9 deletions drivers/mtd/devices/doc2001plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,23 +467,14 @@ void DoCMilPlus_init(struct mtd_info *mtd)

mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->size = 0;

mtd->erasesize = 0;
mtd->writesize = 512;
mtd->oobsize = 16;
mtd->owner = THIS_MODULE;
mtd->erase = doc_erase;
mtd->point = NULL;
mtd->unpoint = NULL;
mtd->read = doc_read;
mtd->write = doc_write;
mtd->read_oob = doc_read_oob;
mtd->write_oob = doc_write_oob;
mtd->sync = NULL;

this->totlen = 0;
this->numchips = 0;
this->curfloor = -1;
this->curchip = -1;

Expand Down
3 changes: 0 additions & 3 deletions drivers/mtd/devices/docg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,13 +1821,10 @@ static void __init doc_set_driver_info(int chip_id, struct mtd_info *mtd)
mtd->oobsize = DOC_LAYOUT_OOB_SIZE;
mtd->owner = THIS_MODULE;
mtd->erase = doc_erase;
mtd->point = NULL;
mtd->unpoint = NULL;
mtd->read = doc_read;
mtd->write = doc_write;
mtd->read_oob = doc_read_oob;
mtd->write_oob = doc_write_oob;
mtd->sync = NULL;
mtd->block_isbad = doc_block_isbad;
mtd->ecclayout = &docg3_oobinfo;
}
Expand Down

0 comments on commit bea7fe0

Please sign in to comment.