On 9/29/25 10:03 AM, Jonas Rebmann wrote:
> Returning PTR_ERR(tlvdev) instead of printing an error message leads to
> the same output when CONFIG_CMD_TLV and when the specified path could
> not be read:
>
> tlv: No such file or directory
>
> In the latter case, print an explanatory message instead.
>
> Signed-off-by: Jonas Rebmann <[email protected]>
Acked-by: Ahmad Fatoum <[email protected]>
FWIW, this is not strictly necessary anymore since:
https://lore.barebox.org/barebox/[email protected]/T/#u
> ---
> commands/tlv.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/commands/tlv.c b/commands/tlv.c
> index 53fbc2a291..6118a2947f 100644
> --- a/commands/tlv.c
> +++ b/commands/tlv.c
> @@ -28,9 +28,11 @@ static int do_tlv(int argc, char *argv[])
> if (!filename)
> return COMMAND_ERROR_USAGE;
>
> - tlvdev = tlv_register_device_by_path(argv[optind], NULL);
> - if (IS_ERR(tlvdev))
> - return PTR_ERR(tlvdev);
> + tlvdev = tlv_register_device_by_path(filename, NULL);
> + if (IS_ERR(tlvdev)) {
> + printf("Could not open \"%s\": %m\n", filename);
> + return COMMAND_ERROR;
> + }
>
> if (fixup)
> return tlv_of_register_fixup(tlvdev);
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |