linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: remove unneeded return statment in mtdswap_write_marker()
@ 2021-04-09  7:56 Luo Meng
  2021-04-09  7:58 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Luo Meng @ 2021-04-09  7:56 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, linux-mtd; +Cc: luomeng12

It should be impossible 'ret !=0' and 'ops.oobretlen != ops.ooblen',
So remove the unneeded return statment.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Luo Meng <luomeng12@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);
-		return ret;
-	}
 
 	return 0;
 }
-- 
2.25.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: remove unneeded return statment in mtdswap_write_marker()
  2021-04-09  7:56 [PATCH] mtd: remove unneeded return statment in mtdswap_write_marker() Luo Meng
@ 2021-04-09  7:58 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2021-04-09  7:58 UTC (permalink / raw)
  To: Luo Meng; +Cc: richard, vigneshr, linux-mtd

Hi Luo,

Luo Meng <luomeng12@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@huawei.com>
> Signed-off-by: Luo Meng <luomeng12@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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-09  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  7:56 [PATCH] mtd: remove unneeded return statment in mtdswap_write_marker() Luo Meng
2021-04-09  7:58 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).