[PATCH] fw_env: fix reading NVMEM device's "compatible" value

Tom Rini trini at konsulko.com
Sat Jan 6 18:41:14 CET 2024


On Tue, Dec 12, 2023 at 06:33:27PM +0100, Rafał Miłecki wrote:

> From: Rafał Miłecki <rafal at milecki.pl>
> 
> Call to fread() was changed to check for return value. The problem is it
> can't be checked for returning 1 (as it is) to determine success.
> 
> We call fread() with buffer size as "size" argument. Reading any
> "compatible" value shorter than buffer size will result in returning 0
> even on success.
> 
> Modify code to use fstat() to determine expected read length.
> 
> This fixes regression that broke using fw_env with NVMEM devices.
> 
> Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240106/c618020f/attachment.sig>


More information about the U-Boot mailing list