Hi Boris, 2017-12-04 18:10 GMT+09:00 Boris Brezillon <boris.brezil...@free-electrons.com>:
>> } >> >> if (!(chip->options & NAND_OWN_BUFFERS)) { >> - nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL); >> - if (!nbuf) >> + chip->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); >> + if (!chip->ecccalc) >> return -ENOMEM; >> >> - nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); >> - if (!nbuf->ecccalc) { >> + chip->ecccode = kmalloc(mtd->oobsize, GFP_KERNEL); >> + if (!chip->ecccode) { >> ret = -ENOMEM; >> goto err_free_nbuf; >> } > > Hm, again not directly related to this patch, but I wonder if we > couldn't allocate those buffers only when they are really needed. For > example, most NAND controllers do the ECC calculation/correct in HW and > simply don't need those buffers. The only idea I came up with is to add a new flag, but I am not sure if you are happy with it because we are removing NAND_OWN_BUFFERS. -- Best Regards Masahiro Yamada