[PATCH] mtd: remove unneeded return statment in mtdswap_write_marker()

Miquel Raynal miquel.raynal at bootlin.com
Fri Apr 9 08:58:43 BST 2021


Hi Luo,

Luo Meng <luomeng12 at huawei.com> wrote on Fri, 9 Apr 2021 15:56:22 +0800:

> It should be impossible 'ret !=0' and 'ops.oobretlen != ops.ooblen',

Why do you say it's impossible?

> So remove the unneeded return statment.
> 
> Reported-by: Hulk Robot <hulkci at huawei.com>
> Signed-off-by: Luo Meng <luomeng12 at huawei.com>
> ---
>  drivers/mtd/mtdswap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
> index 795dec4483c2..12bacb4ae9de 100644
> --- a/drivers/mtd/mtdswap.c
> +++ b/drivers/mtd/mtdswap.c
> @@ -398,12 +398,10 @@ static int mtdswap_write_marker(struct mtdswap_dev *d, struct swap_eb *eb,
>  		return ret;
>  	}
>  
> -	if (ops.oobretlen != ops.ooblen) {
> +	if (ops.oobretlen != ops.ooblen)
>  		dev_warn(d->dev, "Short OOB write for block at %08llx: "
>  			"%zd not %zd\n",
>  			offset, ops.oobretlen, ops.ooblen);

Why do you keep the condition if it's impossible?
Why would you keep the dev_warn and return 0?

> -		return ret;
> -	}
>  
>  	return 0;
>  }

I think this patch can be safely discarded.

Thanks,
Miquèl



More information about the linux-mtd mailing list