lkml.org 
[lkml]   [2023]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 3/5] ubi: Add six fault injection type for testing
From
Date
在 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@huawei.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@huawei.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;
> }
> }
>

\
 
 \ /
  Last update: 2023-10-20 11:10    [W:0.083 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site