xiaoxiang781216 commented on code in PR #3130:
URL: https://github.com/apache/nuttx-apps/pull/3130#discussion_r2212335501
##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -317,8 +294,9 @@ int main(int argc, FAR char *argv[])
if (nbytes < 0)
{
printf("ERROR: write to /dev/mtd0 failed: %d\n", errno);
- fflush(stdout);
- exit(9);
+ close(fd);
Review Comment:
move close to the end and add label err_close
##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -159,8 +159,8 @@ int main(int argc, FAR char *argv[])
if (!master)
{
printf("ERROR: Failed to create RAM MTD instance\n");
- fflush(stdout);
- exit(1);
+ status = 1;
+ goto errout;
Review Comment:
```suggestion
goto ert;
```
##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -204,7 +194,9 @@ int main(int argc, FAR char *argv[])
if (ret < 0)
{
ferr("ERROR: mtd->ioctl failed: %d\n", ret);
- exit(3);
+ unregister_mtddriver("/dev/mtd0");
Review Comment:
move to the end and add label err_unreg
--
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]