[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20190513114059.3934b0bb@windsurf.home>
Date: Mon, 13 May 2019 11:40:59 +0200
From: Thomas Petazzoni <thomas.petazzoni@...tlin.com>
To: masonccyang@...c.com.tw
Cc: bbrezillon@...nel.org, computersforpeace@...il.com,
dwmw2@...radead.org, juliensu@...c.com.tw,
linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
marek.vasut@...il.com, miquel.raynal@...tlin.com, richard@....at
Subject: Re: [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support
Hello,
On Mon, 13 May 2019 15:37:39 +0800
masonccyang@...c.com.tw wrote:
> -------------------------------------------------------------------
> static void macronix_nand_onfi_init(struct nand_chip *chip)
> {
> struct nand_parameters *p = &chip->parameters;
> struct nand_onfi_vendor_macronix *mxic = (void
> *)p->onfi->vendor;
Why cast to void*, instead of casting directly to struct
nand_onfi_vendor_macronix * ?
Also, you are dereferencing p->info before checking whether it's NULL
or not.
> if (!p->onfi ||
> ((mxic->reliability_func & MACRONIX_READ_RETRY_BIT) == 0))
> return;
So, the code should be:
struct nand_onfi_vendor_macronix *mxic;
if (!p->onfi)
return;
mxic = (struct nand_onfi_vendor_macronix *) p->info->vendor;
if ((mxic->reliability_func & MACRONIX_READ_RETRY_BIT) == 0)
return;
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists