[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230925163727.7ecebe9a@xps-13>
Date: Mon, 25 Sep 2023 16:37:27 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Richard Weinberger <richard@....at>
Cc: ZhaoLong Wang <wangzhaolong1@...wei.com>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd <linux-mtd@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
chengzhihao1 <chengzhihao1@...wei.com>,
yi zhang <yi.zhang@...wei.com>,
yangerkun <yangerkun@...wei.com>
Subject: Re: [RFC] mtd: Fix error code loss in mtdchar_read() function.
Hi Richard,
richard@....at wrote on Mon, 25 Sep 2023 16:03:03 +0200 (CEST):
> ----- Ursprüngliche Mail -----
> > Von: "ZhaoLong Wang" <wangzhaolong1@...wei.com>
> > An: "Miquel Raynal" <miquel.raynal@...tlin.com>, "richard" <richard@....at>, "Vignesh Raghavendra" <vigneshr@...com>
> > CC: "linux-mtd" <linux-mtd@...ts.infradead.org>, "linux-kernel" <linux-kernel@...r.kernel.org>, "chengzhihao1"
> > <chengzhihao1@...wei.com>, "ZhaoLong Wang" <wangzhaolong1@...wei.com>, "yi zhang" <yi.zhang@...wei.com>, "yangerkun"
> > <yangerkun@...wei.com>
> > Gesendet: Samstag, 23. September 2023 02:58:56
> > Betreff: [RFC] mtd: Fix error code loss in mtdchar_read() function.
>
> > In the first while loop, if the mtd_read() function returns -EBADMSG
> > and 'retlen' returns 0, the loop break and the function returns value
> > 'total_retlen' is 0, not the error code.
>
> Given this a second thought. I don't think a NAND driver is allowed to return
> less than requests bytes and setting EBADMSG.
> UBI's IO path has a comment on that:
>
> /*
> * The driver should never return -EBADMSG if it failed to read
> * all the requested data. But some buggy drivers might do
> * this, so we change it to -EIO.
> */
> if (read != len && mtd_is_eccerr(err)) {
> ubi_assert(0);
> err = -EIO;
> }
Interesting. Shall we add this check to the mtd_read() path as well?
Maybe with a WARN_ON()?
Thanks,
Miquèl
Powered by blists - more mailing lists