[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR04MB5726CD772469F352B316CF6799C20@VI1PR04MB5726.eurprd04.prod.outlook.com>
Date: Tue, 13 Nov 2018 06:29:31 +0000
From: Yogesh Narayan Gaur <yogeshnarayan.gaur@....com>
To: "Tudor.Ambarus@...rochip.com" <Tudor.Ambarus@...rochip.com>,
"boris.brezillon@...tlin.com" <boris.brezillon@...tlin.com>,
"marek.vasut@...il.com" <marek.vasut@...il.com>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"computersforpeace@...il.com" <computersforpeace@...il.com>,
"richard@....at" <richard@....at>
CC: "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"cyrille.pitchen@...ev4u.fr" <cyrille.pitchen@...ev4u.fr>
Subject: RE: [PATCH v2 1/5] mtd: spi-nor: don't drop sfdp data if optional
parsers fail
> -----Original Message-----
> From: Tudor.Ambarus@...rochip.com [mailto:Tudor.Ambarus@...rochip.com]
> Sent: Friday, November 9, 2018 10:27 PM
> To: boris.brezillon@...tlin.com; marek.vasut@...il.com;
> dwmw2@...radead.org; computersforpeace@...il.com; richard@....at
> Cc: linux-mtd@...ts.infradead.org; linux-kernel@...r.kernel.org; Yogesh
> Narayan Gaur <yogeshnarayan.gaur@....com>; cyrille.pitchen@...ev4u.fr;
> Tudor.Ambarus@...rochip.com
> Subject: [PATCH v2 1/5] mtd: spi-nor: don't drop sfdp data if optional parsers fail
>
> JESD216C states that just the Basic Flash Parameter Table is mandatory.
> Already defined (or future) additional parameter headers and tables are optional.
>
> Don't drop already collected sfdp data in case an optional table parser fails. In
> case of failing, each optional parser is responsible to roll back to the previously
> known spi_nor data.
>
> Fixes: b038e8e3be72 ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
> Reported-by: Yogesh Gaur <yogeshnarayan.gaur@....com>
Tested-by: Yogesh Gaur <yogeshnarayan.gaur@....com>
> Suggested-by: Boris Brezillon <boris.brezillon@...tlin.com>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
> ---
> v2: update Fixes tag to point to correct commit
>
> drivers/mtd/spi-nor/spi-nor.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index
> 4a96ee719e5a..2cdf96013689 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -3130,7 +3130,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
> if (err)
> goto exit;
>
> - /* Parse other parameter headers. */
> + /* Parse optional parameter tables. */
> for (i = 0; i < header.nph; i++) {
> param_header = ¶m_headers[i];
>
> @@ -3143,8 +3143,17 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
> break;
> }
>
> - if (err)
> - goto exit;
> + if (err) {
> + dev_warn(dev, "Failed to parse optional parameter
> table: %04x\n",
> + SFDP_PARAM_HEADER_ID(param_header));
> + /*
> + * Let's not drop all information we extracted so far
> + * if optional table parsers fail. In case of failing,
> + * each optional parser is responsible to roll back to
> + * the previously known spi_nor data.
> + */
> + err = 0;
> + }
> }
>
> exit:
> --
> 2.9.4
Powered by blists - more mailing lists