[U-Boot,2/4] fw_env: fix build error
diff mbox series

Message ID 1566594199-25314-3-git-send-email-pjtexier@koncepto.io
State Superseded
Headers show
Series
  • env: fix build error for envtools
Related show

Commit Message

Pierre-Jean Texier Aug. 23, 2019, 9:03 p.m. UTC
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>
---
 tools/env/fw_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joris OFFOUGA Aug. 24, 2019, 8:49 a.m. UTC | #1
Hi Pierre-Jean

It's work on my side.

Tested-by Joris Offouga <offougajoris@gmail.com>

Best Regards,
Joris Offouga

Le ven. 23 août 2019 à 23:04, Pierre-Jean Texier <pjtexier@koncepto.io> a
écrit :

> 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>
> ---
>  tools/env/fw_env.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 876bf2b..b8b936f 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -1146,7 +1146,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, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
>         ioctl(fd, MEMLOCK, &erase);
>         if (rc < 0)
>                 perror("Could not set obsolete flag");
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
Heiko Schocher Aug. 26, 2019, 6:57 a.m. UTC | #2
Hello Jean-Pierre,

Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
> 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>
> ---
>   tools/env/fw_env.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

See the same problem, thanks for the Fix!

Tested-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Heiko Schocher Aug. 26, 2019, 8:59 a.m. UTC | #3
Hello Pierre-Jean,

Am 26.08.2019 um 08:57 schrieb Heiko Schocher:
> Hello Jean-Pierre,
> 
> Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
>> 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>
>> ---
>>   tools/env/fw_env.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> See the same problem, thanks for the Fix!
> 
> Tested-by: Heiko Schocher <hs@denx.de>

Testing deeper on an imx6 based board with Environment in SPI NOR, and
I see:

root@K30RF-5e108e:~# fw_setenv ubifitsz
Could not set obsolete flag: Operation not supported

Also with your patch ... :-(

With follwoing change fw_setenv works again for me:

hs@xmglap:u-boot  [k30rf] $ git diff
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index b8b936f9ea..e2801f595f 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -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");
hs@xmglap:u-boot  [k30rf] $

May you can try?

bye,
Heiko
Pierre-Jean Texier Aug. 26, 2019, 10:54 a.m. UTC | #4
Hello Heiko,

Le 26/08/2019 à 10:59, Heiko Schocher a écrit :
> Testing deeper on an imx6 based board with Environment in SPI NOR, and
> I see:
> 
> root@K30RF-5e108e:~# fw_setenv ubifitsz
> Could not set obsolete flag: Operation not supported
> 
> Also with your patch ... :-(
> 
> With follwoing change fw_setenv works again for me:
> 
> hs@xmglap:u-boot  [k30rf] $ git diff
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index b8b936f9ea..e2801f595f 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -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");
> hs@xmglap:u-boot  [k30rf] $
> 
> May you can try?

It works fine.

Thanks for testing !
I will send a v2 with your suggestion.

BR
Pierre-Jean

Patch
diff mbox series

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 876bf2b..b8b936f 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1146,7 +1146,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, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
 	ioctl(fd, MEMLOCK, &erase);
 	if (rc < 0)
 		perror("Could not set obsolete flag");