From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F013AECAAD5 for ; Sat, 10 Sep 2022 06:54:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F8E484B68; Sat, 10 Sep 2022 08:54:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="beXVQPyp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5BC1E84B68; Sat, 10 Sep 2022 08:54:02 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 71724845A8 for ; Sat, 10 Sep 2022 08:53:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662792828; bh=PuCiM0ZaCkNMl5K7+8R1oEKfBzhw9iVboWBhKd/PwHY=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=beXVQPypxgo7gElfus19gl1inH7f+MYaKOReDXBeNIF2qSvZbLQh4WhJ1oHr7E9eC A4+R42ZA/R+dohV2bKGzP2IhHgU+Bigb8h8DkaUWSBVeo/bGEphHreDo9Tbs3nVrAb LvNbISWtAVdIikVa60AloEv5C3zI3Hm5Q4lMEpwM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([84.118.157.2]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHoN2-1oahiM1ysw-00Ez7i; Sat, 10 Sep 2022 08:53:48 +0200 Message-ID: <79176e4d-aa18-030e-9ecc-e71b08261d4e@gmx.de> Date: Sat, 10 Sep 2022 08:53:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 02/14] bood To: Simon Glass Cc: U-Boot Mailing List , Alexandru Gagniuc , Artem Lapkin , Philippe Reynes , Sean Anderson References: <20220909151801.336551-1-sjg@chromium.org> <20220909151801.336551-3-sjg@chromium.org> Content-Language: en-US From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:URb+VlfmSoAnXREvMfh8gthsM4c2Ld1lPIDbEXjG1+vmmc/g+R9 DdlsEJ65TlXC4zkm3KdOXb9JxVfh2P+Bv2qbtwh2AceISkf8VN+CNrehnM5H8eB183GtFxH d2/60R2tyAVgAESMe3KudRbQziLO1HCotpLqWSvhYVAO4Q1aygY0mxGlM7DgeBOBOuHVZ7+ ai1Cbax7s6YRpYDXRoT+g== X-UI-Out-Filterresults: notjunk:1;V03:K0:bOnoVXBku84=:TNlKdxQB6+ZXbOa82kBtxe lsNuP6Nuc5pOoCdRWdHeBwEo3v6cpTLqbdBxxtHPqrx3qiKIzQjIgWuNWrjJSe5H/Eqt5jou9 6exE452J+zl9uuKHGuAXQ8+zw555jukACEQDkJsdRv0HNDSQ/Lt1Esr/OQ0UZpMsxPzoYOX7M O7qFWjTyQU9r8grvQ8IB1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precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 9/9/22 20:20, Simon Glass wrote: > Hi Heinrich, > > On Fri, 9 Sept 2022 at 09:33, Heinrich Schuchardt w= rote: >> >> >> >> Am 9. September 2022 17:17:49 MESZ schrieb Simon Glass : >>> At present when bootm fails, it says: >>> >>> subcommand not supported >>> >>> and then prints help for the bootm command. This is not very useful, s= ince >>> generally the error is related to something else, such as fixups faili= ng. >>> It is quite confusing to see this in a test run. >>> >>> Change the error and show the error code. >>> >>> We could update the OS functions to return -ENOSYS when they do not >>> support the bootm subcommand. But this involves some thought since thi= s is >>> arch-specific code and proper errno error codes are not always returne= d. >>> Also, with the code as is, all required subcommands are of course >>> supported - a problem would only come if someone added a new one or >>> removed support for one from an existing OS. Therefore it seems better= to >>> leave that sort of effort for when our bootm tests are improved. >>> >>> Signed-off-by: Simon Glass >>> --- >>> >>> boot/bootm.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/boot/bootm.c b/boot/bootm.c >>> index f6713807fda..ed6b489c4b3 100644 >>> --- a/boot/bootm.c >>> +++ b/boot/bootm.c >>> @@ -790,7 +790,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int fla= g, int argc, >>> >>> /* Check for unsupported subcommand. */ >>> if (ret) { >>> - puts("subcommand not supported\n"); >>> + printf("subcommand failed (err=3D%d)\n", ret); >> >> Return codes are only interpretable by developers. We have a function t= o convert errno to a string. >> >> For the average user it would be helpful to know which (sub-)command f= ailed especially if this boot command is executed in an automated way. > > I don't disagree, but: > 1. The error strings add to code size, about 5KB or so This is controlled by CONFIG_ERRNO_STR. > 2. For devs the error number is much easier to use > 3. For bug reports the error number is better too IMO > 4. As per the commit message, we don't have a consistent way for > subcommands to report errors > > So I think this patch is an improvement, in that it actually says what > is happening (rather than mostly saying something that is untrue) and > does not increase code size much. > > I wonder if we should have a way to show an error number + string in pri= ntf()? > > printf("subcommand failed (%pE)\n", ret); %p is meant for pointers only. Using it for an integer will lead to a build error: format =E2=80=98%p=E2=80=99 expects argument of type =E2=80=98void *= =E2=80=99, but argument 2 has type =E2=80=98int=E2=80=99 For signed int we have the choice of: '%d', '%i', '%o', or '%x'. I suggest to use %iE. %dE already occurs in existing code: include/ansi.h:15 :#define ANSI_CURSOR_NEXTLINE "\e[%dE" > > I don't fully understand how we allow things after %p without > ambiguity...do you know? We rely on developers only wanting to print a pointer not using any character with special meaning after %p. If you actually wanted to print the letter 'D' directly after a pointer you would have to put it into a separate string: printf("%p""D", p); In our existing code %i is succeeded by the following characters: ' ', '!', '"', ')', ',', '.', ':', '@', '\', ']', '0', 'a', 'g', 'n', 'o'. So using 'E' is safe. For %d succeeding characters are: ' ', '!', '"', '%', ''', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=3D', '>', '?', '@', '[', '\', ']', '_', '}', '0', '1', '2', '3', '4', '5', '7', 'a', 'A', 'b', 'B', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'G', 'H', 'i', 'k', 'K', 'm', 'M', 'n', 'o', 'p', 'r', 'R', 's', 'T', 'u', 'W', 'x'. For %o: ' ', '"', ')', 'b', 'p', 'r'. For %x: '!', '"', '#', '%', ''', '(', ')', ',', '-', '.', '/', ':', ';', '>', '[', '\', ']', '_', '}', '1', 'h', 'n' Best regards Heinrich