[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ldmxm1tu.fsf@bootlin.com>
Date: Tue, 02 Sep 2025 15:16:45 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Zhihao Cheng <chengzhihao1@...wei.com>
Cc: Wang Zhaolong <wangzhaolong@...weicloud.com>, <richard@....at>,
<vigneshr@...com>, <linux-mtd@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>,
<yangerkun@...wei.com>
Subject: Re: [PATCH V2] mtd: core: skip badblocks increment for blocks
already known bad
>> @@ -2349,11 +2350,19 @@ int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
>> return -EROFS;
>> if (mtd->flags & MTD_SLC_ON_MLC_EMULATION)
>> ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize;
>> - ret = master->_block_markbad(master, mtd_get_master_ofs(mtd,
>> ofs));
>> + moffs = mtd_get_master_ofs(mtd, ofs);
>> +
>> + if (master->_block_isbad) {
>> + ret = master->_block_isbad(master, moffs);
>> + if (ret > 0)
>> + return 0;
>
> Hi, Miquèl.
> Here, should we keep the same logic with the lower
> level(eg. nand_block_markbad, onenand_block_markbad) when 'ret < 0' is
> returned by master->_block_isbad. Many specific nand drivers(markbad)
> return the negative code when 'isbad' fails.
Good question, I guess in case of error in isbad() we shall probably
still try to mark the block bad because actually marking a block bad is
probably more important than returning correct statistics.
Thanks,
Miquèl
Powered by blists - more mailing lists