Messages in this thread |  | | Date | Mon, 13 May 2019 11:40:59 +0200 | From | Thomas Petazzoni <> | Subject | Re: [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support |
| |
Hello,
On Mon, 13 May 2019 15:37:39 +0800 masonccyang@mxic.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
|  |