mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jonas Rebmann <jre@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Tobias Waldekranz <tobias@waldekranz.com>,
	 Jonas Rebmann <jre@pengutronix.de>
Subject: [PATCH v2 6/9] commands: tlv: clarify error opening tlv
Date: Mon, 29 Sep 2025 10:03:57 +0200	[thread overview]
Message-ID: <20250929-tlv-integration-v2-6-55f75da7e670@pengutronix.de> (raw)
In-Reply-To: <20250929-tlv-integration-v2-0-55f75da7e670@pengutronix.de>

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 <jre@pengutronix.de>
---
 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);

-- 
2.51.0.297.gca2559c1d6




  parent reply	other threads:[~2025-09-29  8:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29  8:03 [PATCH v2 0/9] TLV integration tests and test/py cleanup Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 1/9] test: when testfs feature is available, always enable it Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 2/9] test: provide testfs via fixture Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 3/9] test: move dm-verity testdata generation to fixture Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 4/9] test: move fitimage testdata generation to fixture and drop script Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 5/9] test: py: test_bootchooser: remove dead code Jonas Rebmann
2025-09-29  8:03 ` Jonas Rebmann [this message]
2025-09-29  8:03 ` [PATCH v2 7/9] ci: container: install crcmod and cryptography Jonas Rebmann
2025-09-29  8:03 ` [PATCH v2 8/9] configs: enable tlv command for multi_v7 and multi_v8 Jonas Rebmann
2025-09-29  8:04 ` [PATCH v2 9/9] test: py: add TLV integration tests Jonas Rebmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250929-tlv-integration-v2-6-55f75da7e670@pengutronix.de \
    --to=jre@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=tobias@waldekranz.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox