xiaoxiang781216 commented on code in PR #16738:
URL: https://github.com/apache/nuttx/pull/16738#discussion_r2214843858
##########
boards/arm/at32/at32f437-mini/src/at32_at24.c:
##########
@@ -108,14 +109,15 @@ int at32_at24_automount(int minor)
return ret;
}
#else
- /* And use the FTL layer to wrap the MTD driver as a block driver */
+ /* Register the MTD driver */
- finfo("Initialize the FTL layer to create /dev/mtdblock%d\n",
- AT24_MINOR);
- ret = ftl_initialize(AT24_MINOR, mtd);
+ char path[NAME_MAX + 5];
+ snprintf(path, NAME_MAX + 5, "/dev/mtdblock%d", AT24_MINOR);
Review Comment:
```suggestion
snprintf(path, sizeof(path), "/dev/mtdblock%d", AT24_MINOR);
```
In ALL places.
##########
boards/arm/at32/at32f437-mini/src/at32_at24.c:
##########
@@ -108,14 +109,15 @@ int at32_at24_automount(int minor)
return ret;
}
#else
- /* And use the FTL layer to wrap the MTD driver as a block driver */
+ /* Register the MTD driver */
- finfo("Initialize the FTL layer to create /dev/mtdblock%d\n",
- AT24_MINOR);
- ret = ftl_initialize(AT24_MINOR, mtd);
+ char path[NAME_MAX + 5];
Review Comment:
```suggestion
char path[32];
```
##########
boards/arm/at32/at32f437-mini/src/at32_at24.c:
##########
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <errno.h>
#include <debug.h>
+#include <limits.h>
Review Comment:
why need
##########
boards/arm/at32/at32f437-mini/src/at32_w25.c:
##########
@@ -126,14 +127,18 @@ int at32_w25initialize(int minor)
}
#ifndef CONFIG_FS_SMARTFS
- /* And use the FTL layer to wrap the MTD driver as a block driver */
+ /* Register the MTD driver */
- ret = ftl_initialize(minor, mtd);
+ char path[NAME_MAX + 5];
+ snprintf(path, NAME_MAX + 5, "/dev/mtdblock%d", minor);
+ ret = register_mtddriver(path, mtd, 0755, NULL);
if (ret < 0)
{
- syslog(LOG_ERR, "ERROR: Initialize the FTL layer\n");
+ syslog(LOG_ERR, "ERROR: Failed to register the MTD driver %s ret %d\n",
+ path, ret);
return ret;
}
+
Review Comment:
revert
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]