mirror of
https://github.com/apache/nuttx.git
synced 2026-03-23 14:05:12 +08:00
mtd/parition:MTD partiton check whether the erase interface exist
Since there is a storage device like RRAM that doesn't require erasing, the MTD erase function may not exist. Here, we should first check whether the erase interface exists before performing the erasing operation. Signed-off-by: jingfei <jingfei@xiaomi.com>
This commit is contained in:
@@ -901,7 +901,7 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd,
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
part->child.erase = part_erase;
|
||||
part->child.erase = mtd->erase ? part_erase : NULL;
|
||||
part->child.bread = part_bread;
|
||||
part->child.bwrite = part_bwrite;
|
||||
part->child.read = mtd->read ? part_read : NULL;
|
||||
|
||||
Reference in New Issue
Block a user