aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-02-28 05:02:30 -0500
committerBrian Norris <computersforpeace@gmail.com>2015-03-11 18:21:48 -0400
commit0ec56dc4a1489d5b1d23d1c019b76a69ce153805 (patch)
treef3a80f7d26a2e57e409e02e4602a60217b2c8be5 /drivers/mtd
parente22b7651ef23ad90eed4bdbe75f12194f47d7a4f (diff)
mtd: nand: fully initialize mtd_oob_ops
We're not initializing the ooblen field. Our users don't care, since they check that oobbuf == NULL first, but it's good practice to zero unused fields out. We can drop the NULL initializations since we're memset()ing the whole thing. Noticed by Coverity, CID #200821, #200822 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5488a7ad63e7..d4cec2f8a016 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -386,7 +386,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
386 uint8_t buf[2] = { 0, 0 }; 386 uint8_t buf[2] = { 0, 0 };
387 int ret = 0, res, i = 0; 387 int ret = 0, res, i = 0;
388 388
389 ops.datbuf = NULL; 389 memset(&ops, 0, sizeof(ops));
390 ops.oobbuf = buf; 390 ops.oobbuf = buf;
391 ops.ooboffs = chip->badblockpos; 391 ops.ooboffs = chip->badblockpos;
392 if (chip->options & NAND_BUSWIDTH_16) { 392 if (chip->options & NAND_BUSWIDTH_16) {
@@ -1716,9 +1716,9 @@ static int nand_read(struct mtd_info *mtd, loff_t from, size_t len,
1716 int ret; 1716 int ret;
1717 1717
1718 nand_get_device(mtd, FL_READING); 1718 nand_get_device(mtd, FL_READING);
1719 memset(&ops, 0, sizeof(ops));
1719 ops.len = len; 1720 ops.len = len;
1720 ops.datbuf = buf; 1721 ops.datbuf = buf;
1721 ops.oobbuf = NULL;
1722 ops.mode = MTD_OPS_PLACE_OOB; 1722 ops.mode = MTD_OPS_PLACE_OOB;
1723 ret = nand_do_read_ops(mtd, from, &ops); 1723 ret = nand_do_read_ops(mtd, from, &ops);
1724 *retlen = ops.retlen; 1724 *retlen = ops.retlen;
@@ -2508,9 +2508,9 @@ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
2508 /* Grab the device */ 2508 /* Grab the device */
2509 panic_nand_get_device(chip, mtd, FL_WRITING); 2509 panic_nand_get_device(chip, mtd, FL_WRITING);
2510 2510
2511 memset(&ops, 0, sizeof(ops));
2511 ops.len = len; 2512 ops.len = len;
2512 ops.datbuf = (uint8_t *)buf; 2513 ops.datbuf = (uint8_t *)buf;
2513 ops.oobbuf = NULL;
2514 ops.mode = MTD_OPS_PLACE_OOB; 2514 ops.mode = MTD_OPS_PLACE_OOB;
2515 2515
2516 ret = nand_do_write_ops(mtd, to, &ops); 2516 ret = nand_do_write_ops(mtd, to, &ops);
@@ -2536,9 +2536,9 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len,
2536 int ret; 2536 int ret;
2537 2537
2538 nand_get_device(mtd, FL_WRITING); 2538 nand_get_device(mtd, FL_WRITING);
2539 memset(&ops, 0, sizeof(ops));
2539 ops.len = len; 2540 ops.len = len;
2540 ops.datbuf = (uint8_t *)buf; 2541 ops.datbuf = (uint8_t *)buf;
2541 ops.oobbuf = NULL;
2542 ops.mode = MTD_OPS_PLACE_OOB; 2542 ops.mode = MTD_OPS_PLACE_OOB;
2543 ret = nand_do_write_ops(mtd, to, &ops); 2543 ret = nand_do_write_ops(mtd, to, &ops);
2544 *retlen = ops.retlen; 2544 *retlen = ops.retlen;