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]> --- 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
