From: Marek Vasut Date: Mon, 22 Apr 2019 18:40:33 +0200 Subject: [U-Boot] spl: avoid printf when we might be doing Ymodem with CONFIG_SPL_FIT_SIGNATURE In-Reply-To: <20190422161212.GD4664@bill-the-cat> References: <20190320195220.3212-1-alex.kiernan@gmail.com> <20190422161212.GD4664@bill-the-cat> Message-ID: <32faa2df-3aef-a084-26ac-919317623071@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 4/22/19 6:12 PM, Tom Rini wrote: > On Wed, Mar 20, 2019 at 07:52:20PM +0000, Alex Kiernan wrote: >> If CONFIG_SPL_FIT_SIGNATURE is enabled and U-Boot is being loaded from UART >> over Ymodem then we can't emit messages using printf() without causing >> errors like: >> >> Sending: u-boot-dtb.img >> Ymodem sectors/kbytes sent: 3009/376kRetry 0: Got 23 for sector ACK >> Retry 0: NAK on sector >> Retry 0: Got 68 for sector ACK >> Retry 0: NAK on sector >> Ymodem sectors/kbytes sent: 3273/409kRetry 0: Got 23 for sector ACK >> Retry 0: NAK on sector >> Retry 0: Got 68 for sector ACK >> Retry 0: NAK on sector >> >> Use debug() rather than printf() to avoid sending messages on the serial >> port. >> >> Signed-off-by: Alex Kiernan >> --- >> >> common/spl/spl_fit.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c >> index db436268cbcd..08faf2c1b058 100644 >> --- a/common/spl/spl_fit.c >> +++ b/common/spl/spl_fit.c >> @@ -240,12 +240,12 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, >> } >> >> #ifdef CONFIG_SPL_FIT_SIGNATURE >> - printf("## Checking hash(es) for Image %s ... ", >> - fit_get_name(fit, node, NULL)); >> + debug("## Checking hash(es) for Image %s ... ", >> + fit_get_name(fit, node, NULL)); >> if (!fit_image_verify_with_data(fit, node, >> src, length)) >> return -EPERM; >> - puts("OK\n"); >> + debug("OK\n"); >> #endif >> >> #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS > > I think in this case we want to have that bit of "garbage" happen as the > protocol handles them correctly and if there is a problem it's visible > "on the line" to be seen at least and can be dug at. The other > alternative here would be to re-work the code to only printf anything on > the error case and debug that we're checking at all. Can we do something similar to this ? https://patchwork.ozlabs.org/patch/1055047/ -- Best regards, Marek Vasut