[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cec45406-85b6-d964-fede-8d16a457308d@huawei.com>
Date: Fri, 20 Oct 2023 17:09:59 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: ZhaoLong Wang <wangzhaolong1@...wei.com>,
<miquel.raynal@...tlin.com>, <richard@....at>, <vigneshr@...com>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<yi.zhang@...wei.com>, <yangerkun@...wei.com>
Subject: Re: [PATCH v3 3/5] ubi: Add six fault injection type for testing
在 2023/10/20 14:48, ZhaoLong Wang 写道:
> This commit adds six fault injection type for testing to cover the
> abnormal path of the UBI driver.
>
> Inject the following faults when the UBI reads the LEB:
> +----------------------------+-----------------------------------+
> | Interface name | emulate behavior |
> +----------------------------+-----------------------------------+
> | emulate_eccerr | ECC error |
> +----------------------------+-----------------------------------+
> | emulate_read_failure | read failure |
> |----------------------------+-----------------------------------+
> | emulate_io_ff | read content as all FF |
> |----------------------------+-----------------------------------+
> | emulate_io_ff_bitflips | content FF with MTD err reported |
> +----------------------------+-----------------------------------+
> | emulate_bad_hdr | bad leb header |
> |----------------------------+-----------------------------------+
> | emulate_bad_hdr_ebadmsg | bad header with ECC err |
> +----------------------------+-----------------------------------+
>
> Signed-off-by: ZhaoLong Wang <wangzhaolong1@...wei.com>
> ---
> drivers/mtd/ubi/debug.c | 30 +++++++
> drivers/mtd/ubi/debug.h | 170 ++++++++++++++++++++++++++++++++++++++--
> drivers/mtd/ubi/io.c | 76 +++++++++++++++++-
> drivers/mtd/ubi/ubi.h | 30 ++++---
> 4 files changed, 286 insertions(+), 20 deletions(-)
>
Reviewed-by: Zhihao Cheng <chengzhihao1@...wei.com>
One small nit below.
[...]
> diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
> index ffa7bbf27bc2..803e2b7f1d17 100644
> --- a/drivers/mtd/ubi/io.c
> +++ b/drivers/mtd/ubi/io.c
> @@ -195,7 +195,19 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
>
> if (ubi_dbg_is_bitflip(ubi)) {
> dbg_gen("bit-flip (emulated)");
> - err = UBI_IO_BITFLIPS;
> + return UBI_IO_BITFLIPS;
There are 2 spaces between 'return' and 'UBI_IO_BITFLIPS'.
> + }
> +
> + if (ubi_dbg_is_read_failure(ubi, MASK_READ_FAILURE)) {
> + ubi_warn(ubi, "cannot read %d bytes from PEB %d:%d (emulated)",
> + len, pnum, offset);
> + return -EIO;
> + }
> +
> + if (ubi_dbg_is_eccerr(ubi)) {
> + ubi_warn(ubi, "ECC error (emulated) while reading %d bytes from PEB %d:%d, read %zd bytes",
> + len, pnum, offset, read);
> + return -EBADMSG;
> }
> }
>
Powered by blists - more mailing lists