<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/tools/env, branch v2023.04</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>tools: env: fw_env: Fix unused-result warning</title>
<updated>2022-12-08T14:25:44+00:00</updated>
<author>
<name>Jaehoon Chung</name>
<email>jh80.chung@samsung.com</email>
</author>
<published>2022-10-13T08:41:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c059a22b7776dc4306acb73cbeb78e841cf60b84'/>
<id>c059a22b7776dc4306acb73cbeb78e841cf60b84</id>
<content type='text'>
Fix unused-result warning about fread.

tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
 1751 |   fread(buf, sizeof(buf), 1, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix unused-result warning about fread.

tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
 1751 |   fread(buf, sizeof(buf), 1, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: Fix missing closedir in ubi_get_volnum_by_name</title>
<updated>2022-09-29T14:10:39+00:00</updated>
<author>
<name>Miaoqian Lin</name>
<email>linmq006@gmail.com</email>
</author>
<published>2022-09-19T04:28:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=316590db29b484209dbc3c3d60561168d0f7263c'/>
<id>316590db29b484209dbc3c3d60561168d0f7263c</id>
<content type='text'>
The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin &lt;linmq006@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin &lt;linmq006@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: add fallback to Linux's NVMEM based access</title>
<updated>2022-07-08T13:06:57+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2022-06-16T18:59:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=8142c4554ffaa927529f24427a35f7ee2861793a'/>
<id>8142c4554ffaa927529f24427a35f7ee2861793a</id>
<content type='text'>
A new DT binding for describing environment data block has been added in
Linux's commit 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment
variables binding"). Once we get a proper Linux NVMEM driver it'll be
possible to use Linux's binary interface for user-space as documented
in the:
https://www.kernel.org/doc/html/latest/driver-api/nvmem.html

This commits makes fw_env fallback to looking for a compatible NVMEM
device in case config file isn't present. In a long term this may make
config files redundant and avoid code (info) duplication.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A new DT binding for describing environment data block has been added in
Linux's commit 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment
variables binding"). Once we get a proper Linux NVMEM driver it'll be
possible to use Linux's binary interface for user-space as documented
in the:
https://www.kernel.org/doc/html/latest/driver-api/nvmem.html

This commits makes fw_env fallback to looking for a compatible NVMEM
device in case config file isn't present. In a long term this may make
config files redundant and avoid code (info) duplication.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: simplify logic &amp; code paths in the fw_env_open()</title>
<updated>2022-02-11T16:29:23+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2022-01-12T11:47:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=07c79dd5fdeaefb39c9e7a97f3b66de63109a18d'/>
<id>07c79dd5fdeaefb39c9e7a97f3b66de63109a18d</id>
<content type='text'>
Environment variables can be stored in two formats:
1. Single entry with header containing CRC32
2. Two entries with extra flags field in each entry header

For that reason fw_env_open() has two main code paths and there are
pointers for CRC32/flags/data.

Previous implementation was a bit hard to follow:
1. It was checking for used format twice (in reversed order each time)
2. It was setting "environment" global struct fields to some temporary
   values that required extra comments explaining it

This change simplifies that code:
1. It introduces two clear code paths
2. It sets "environment" global struct fields values only once it really
   knows them

To be fair there are *two* crc32() calls now and an extra pointer
variable but that should be cheap enough and worth it.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Environment variables can be stored in two formats:
1. Single entry with header containing CRC32
2. Two entries with extra flags field in each entry header

For that reason fw_env_open() has two main code paths and there are
pointers for CRC32/flags/data.

Previous implementation was a bit hard to follow:
1. It was checking for used format twice (in reversed order each time)
2. It was setting "environment" global struct fields to some temporary
   values that required extra comments explaining it

This change simplifies that code:
1. It introduces two clear code paths
2. It sets "environment" global struct fields values only once it really
   knows them

To be fair there are *two* crc32() calls now and an extra pointer
variable but that should be cheap enough and worth it.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: make flash_io() take buffer as an argument</title>
<updated>2022-02-11T16:29:23+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2022-01-12T11:47:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f178f7c9550c4fd9c644f79a1eb2dafa5bcdce25'/>
<id>f178f7c9550c4fd9c644f79a1eb2dafa5bcdce25</id>
<content type='text'>
It's usually easier to understand code &amp; follow it if all arguments are
passed explicitly. Many coding styles also discourage using global
variables.

Behaviour of flash_io() was a bit unintuitive as it was writing to a
buffer referenced in a global struct. That required developers to
remember how it works and sometimes required hacking "environment"
global struct variable to read data into a proper buffer.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's usually easier to understand code &amp; follow it if all arguments are
passed explicitly. Many coding styles also discourage using global
variables.

Behaviour of flash_io() was a bit unintuitive as it was writing to a
buffer referenced in a global struct. That required developers to
remember how it works and sometimes required hacking "environment"
global struct variable to read data into a proper buffer.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_setenv: Unbreak fw_setenv caused by buggy MEMISLOCKED use</title>
<updated>2021-12-20T14:21:48+00:00</updated>
<author>
<name>Joakim Tjernlund</name>
<email>joakim.tjernlund@infinera.com</email>
</author>
<published>2021-12-08T14:33:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=08cf1a5e6995697bcf2405ae50826634bc43d78a'/>
<id>08cf1a5e6995697bcf2405ae50826634bc43d78a</id>
<content type='text'>
Commit "fw_setenv: lock the flash only if it was locked before"
checks for Locked status with uninitialized erase data.
Address by moving the test for MEMISLOCKED.

Fixes: 8a726b852502 ("fw_setenv: lock the flash only if it was locked before")
Signed-off-by: Joakim Tjernlund &lt;joakim.tjernlund@infinera.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit "fw_setenv: lock the flash only if it was locked before"
checks for Locked status with uninitialized erase data.
Address by moving the test for MEMISLOCKED.

Fixes: 8a726b852502 ("fw_setenv: lock the flash only if it was locked before")
Signed-off-by: Joakim Tjernlund &lt;joakim.tjernlund@infinera.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: Handle shorter read calls</title>
<updated>2021-09-02T15:19:58+00:00</updated>
<author>
<name>Thibault Ferrante</name>
<email>thibaultferrante@gmail.com</email>
</author>
<published>2021-08-24T15:29:50+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=6628813f9d400c49da4926f01833063a30151cdb'/>
<id>6628813f9d400c49da4926f01833063a30151cdb</id>
<content type='text'>
On some cases, the actual number of bytes read can be shorter
than what was requested. This can be handled gracefully by
taking this difference into account instead of exiting.

Signed-off-by: Thibault Ferrante &lt;thibault.ferrante@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On some cases, the actual number of bytes read can be shorter
than what was requested. This can be handled gracefully by
taking this difference into account instead of exiting.

Signed-off-by: Thibault Ferrante &lt;thibault.ferrante@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: return error if ubi_update_start() fails</title>
<updated>2021-01-22T21:58:55+00:00</updated>
<author>
<name>Martin Hundebøll</name>
<email>martin@geanix.com</email>
</author>
<published>2020-11-30T11:11:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=09779488a924dbc4eb3b4ae145632f22b7f5a36c'/>
<id>09779488a924dbc4eb3b4ae145632f22b7f5a36c</id>
<content type='text'>
The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't
obtained. If this happens, the flush operation doesn't return error,
leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes: 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")
Signed-off-by: Martin Hundebøll &lt;martin@geanix.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't
obtained. If this happens, the flush operation doesn't return error,
leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes: 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")
Signed-off-by: Martin Hundebøll &lt;martin@geanix.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: Avoid an uninited warning with was_locked</title>
<updated>2020-08-05T12:18:34+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2020-08-01T16:30:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7b27e0fe13d8d44da6cd357a69668a726b852502'/>
<id>7b27e0fe13d8d44da6cd357a69668a726b852502</id>
<content type='text'>
Set this variable to 0 to avoid a warning about an unused variable. This
happens on gcc 7.5.0 for me.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Set this variable to 0 to avoid a warning about an unused variable. This
happens on gcc 7.5.0 for me.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: Fix printf() warning in fw_env</title>
<updated>2020-08-05T12:18:34+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2020-08-01T16:30:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d9cd4d2a8d429068a6a5061a33459ae3ae113ef8'/>
<id>d9cd4d2a8d429068a6a5061a33459ae3ae113ef8</id>
<content type='text'>
The printf() string produces a warning about %d not matching size_t. Fix
it and put the format string on one line to avoid a checkpatch warning.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The printf() string produces a warning about %d not matching size_t. Fix
it and put the format string on one line to avoid a checkpatch warning.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
