lkml.org 
[lkml]   [2019]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-05-13 11:41    [W:0.112 / U:6.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site