From: Miquel Raynal Date: Thu, 19 Sep 2019 19:06:21 +0000 (+0200) Subject: mtd: Initialize all parameters of mtd_oob_ops X-Git-Tag: v5.15~5114^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=717bc8a6b4399f3ef907e92a01914fbae0465fd6;p=platform%2Fkernel%2Flinux-starfive.git mtd: Initialize all parameters of mtd_oob_ops Most of the time the ooboffs parameter of the mtd_oob_ops structure was initialized only when needed. Since the introduction of the SPI-NAND subsystem, this parameter is transferred into nand_page_io_req structure automatically and may be used by any SPI-NAND user. Before this happens, initialize all the structure parameters when they are created in mtdchar.c. Signed-off-by: Miquel Raynal --- diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 975aed9..b841008 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -174,7 +174,7 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count, break; case MTD_FILE_MODE_RAW: { - struct mtd_oob_ops ops; + struct mtd_oob_ops ops = {}; ops.mode = MTD_OPS_RAW; ops.datbuf = kbuf; @@ -268,7 +268,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c case MTD_FILE_MODE_RAW: { - struct mtd_oob_ops ops; + struct mtd_oob_ops ops = {}; ops.mode = MTD_OPS_RAW; ops.datbuf = kbuf; @@ -350,7 +350,7 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, uint32_t __user *retp) { struct mtd_file_info *mfi = file->private_data; - struct mtd_oob_ops ops; + struct mtd_oob_ops ops = {}; uint32_t retlen; int ret = 0; @@ -394,7 +394,7 @@ static int mtdchar_readoob(struct file *file, struct mtd_info *mtd, uint32_t __user *retp) { struct mtd_file_info *mfi = file->private_data; - struct mtd_oob_ops ops; + struct mtd_oob_ops ops = {}; int ret = 0; if (length > 4096) @@ -587,7 +587,7 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp) { struct mtd_write_req req; - struct mtd_oob_ops ops; + struct mtd_oob_ops ops = {}; const void __user *usr_data, *usr_oob; int ret;