52 lines
1.4 KiB
Diff
52 lines
1.4 KiB
Diff
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
|
|
index 8b0317a..575f12a 100644
|
|
--- a/tools/env/fw_env.c
|
|
+++ b/tools/env/fw_env.c
|
|
@@ -888,12 +888,13 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
|
|
}
|
|
}
|
|
|
|
- if (lseek (fd, blockstart, SEEK_SET) == -1) {
|
|
- fprintf (stderr,
|
|
- "Seek error on %s: %s\n",
|
|
- DEVNAME (dev), strerror (errno));
|
|
- return -1;
|
|
- }
|
|
+ if (blockstart != 0)
|
|
+ if (lseek (fd, blockstart, SEEK_SET) == -1) {
|
|
+ fprintf (stderr,
|
|
+ "Seek error on %s: %s\n",
|
|
+ DEVNAME (dev), strerror (errno));
|
|
+ return -1;
|
|
+ }
|
|
|
|
#ifdef DEBUG
|
|
fprintf(stderr, "Write 0x%x bytes at 0x%llx\n", erasesize,
|
|
@@ -1025,25 +1026,8 @@ static int flash_read (int fd)
|
|
return -1;
|
|
}
|
|
|
|
- if (S_ISCHR(st.st_mode)) {
|
|
- rc = ioctl(fd, MEMGETINFO, &mtdinfo);
|
|
- if (rc < 0) {
|
|
- fprintf(stderr, "Cannot get MTD information for %s\n",
|
|
- DEVNAME(dev_current));
|
|
- return -1;
|
|
- }
|
|
- if (mtdinfo.type != MTD_NORFLASH &&
|
|
- mtdinfo.type != MTD_NANDFLASH &&
|
|
- mtdinfo.type != MTD_DATAFLASH &&
|
|
- mtdinfo.type != MTD_UBIVOLUME) {
|
|
- fprintf (stderr, "Unsupported flash type %u on %s\n",
|
|
- mtdinfo.type, DEVNAME(dev_current));
|
|
- return -1;
|
|
- }
|
|
- } else {
|
|
- memset(&mtdinfo, 0, sizeof(mtdinfo));
|
|
- mtdinfo.type = MTD_ABSENT;
|
|
- }
|
|
+ memset(&mtdinfo, 0, sizeof(mtdinfo));
|
|
+ mtdinfo.type = MTD_ABSENT;
|
|
|
|
DEVTYPE(dev_current) = mtdinfo.type;
|
|
|