fw_env: fix build error
authorPierre-Jean Texier <pjtexier@koncepto.io>
Mon, 26 Aug 2019 11:06:16 +0000 (13:06 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 24 Sep 2019 21:46:13 +0000 (17:46 -0400)
The following error appears:

tools/env/fw_env.c:1149:25: error: lvalue required as unary ‘&’ operand
  rc = write(fd, &ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));

Fixes: d3716dd ("env: Rename the redundancy flags")
Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Joris Offouga <offougajoris@gmail.com>
Tested-by: Heiko Schocher <hs@denx.de>
Suggested-by: Heiko Schocher <hs@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
tools/env/fw_env.c

index 876bf2b2daafe3a273c0a9a4211e6db3e43a421c..e2801f595f6f824b16af1489227b1453c6a12481 100644 (file)
@@ -1135,6 +1135,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
 {
        int rc;
        struct erase_info_user erase;
+       char tmp = ENV_REDUND_OBSOLETE;
 
        erase.start = DEVOFFSET(dev);
        erase.length = DEVESIZE(dev);
@@ -1146,7 +1147,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
                return rc;
        }
        ioctl(fd, MEMUNLOCK, &erase);
-       rc = write(fd, &ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
+       rc = write(fd, &tmp, sizeof(tmp));
        ioctl(fd, MEMLOCK, &erase);
        if (rc < 0)
                perror("Could not set obsolete flag");