From patchwork Thu Aug 5 19:06:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matwey V. Kornilov" X-Patchwork-Id: 1514052 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FDaqsY5Y; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GgdPc6xgJz9sWq for ; Fri, 6 Aug 2021 05:06:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8035D82C04; Thu, 5 Aug 2021 21:06:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FDaqsY5Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8796F82C47; Thu, 5 Aug 2021 21:06:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 871BE82BC4 for ; Thu, 5 Aug 2021 21:06:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matwey.kornilov@gmail.com Received: by mail-lf1-x12d.google.com with SMTP id f42so13071021lfv.7 for ; Thu, 05 Aug 2021 12:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CzyScuGjDLs6/2gM9OQ33DGDu2+nwBM03ypLx620M9o=; b=FDaqsY5YFGR+AVvvZ90NEhNIH84Eiyn4HEwWKBbaa6aOuoOQrlzVW/hPeZI78dH3ZI n/Pmh6bVcvvctlGq34WUyMCUPiDGqPItsmdZT0ttgbGeE0fjaAxiTfuRk5kyHUZJ2LUU 4ocRck1uskE6WXfxfg/oHzxaFUfOrS13A4rUDCIbVOP2c7WA/2w5yBSTSOKEqt4Kvyo5 0xTtLsiTprXaHbyEGVYuPPNkNWeqigmmJj8zw4kHha4WnrU6I2wXUItxzOWs7SC9R2be WqQ6271cUo2Vnj5Mby4fXn/Fq2pa74NScFfbPYRP73MUSwxEu7Gh3Mkn675n08fZz7mJ 0XGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CzyScuGjDLs6/2gM9OQ33DGDu2+nwBM03ypLx620M9o=; b=CYdVsIXvfwHzKeTj7ZXInTvUo/vXLfvdlZl80dZTnBWs4rati4GUBcSIzdTBErp3lq NHoaL+X2k8wrLXgascn+foIcEJWHhDeQu0Gg7uzvCZ2UPhjyQno0V/Qb/xpJTmngTHbT yPi+7mdyezjCtthD3CeQvBYunJ4QVyrOXXc1WIlGaJsxrzRw/95wIgiYG3BB/vTkRgsO WhnL4tWIUbMBl4AZ+Grfyppx65+DRemtnD/G0+8zK1C0UMX3tbCK5s0Y2Xiu4nH90kje Fh5/9X0sDaOofC+K0OlCREZR/f65DxZhOthkVFkmy/XxTR+eqaXkZ25977KwCvlgTTDe XsSA== X-Gm-Message-State: AOAM533Go4ygB/DGGKfyvx81DRqq6QB4F/5geLbqAVuaSKlUrwCPxtg8 2kagdwHSVOFCrdB+Tr6y4fo= X-Google-Smtp-Source: ABdhPJzl5oeInhno7ObMpU+fupMGwzVQ0rAzuQvTg8+SDASYdYCkylKj9PEXuJRjkLRuMF1b7j/U2A== X-Received: by 2002:ac2:4951:: with SMTP id o17mr4922662lfi.214.1628190370606; Thu, 05 Aug 2021 12:06:10 -0700 (PDT) Received: from oak.local ([2001:470:28:561:2991:a833:31da:2248]) by smtp.gmail.com with ESMTPSA id r11sm506591ljj.90.2021.08.05.12.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 12:06:09 -0700 (PDT) From: "Matwey V. Kornilov" To: sjg@chromium.org, trini@konsulko.com, vigneshr@ti.com Cc: u-boot@lists.denx.de, "Matwey V. Kornilov" Subject: [PATCH v2] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled Date: Thu, 5 Aug 2021 22:06:05 +0300 Message-Id: <20210805190605.32719-1-matwey.kornilov@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean %pM format string is used to print MAC-address and this is required while SPL network boot. This patch fixes the SPL boot issues like the following: Trying to boot from USB eth ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m) ## Error inserting "ethaddr" variable, errno=1 eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <= "81f01114M" (type: m) ## Error inserting "eth1addr" variable, errno=1 , eth1: usb_ether eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT ! Problem booting with BOOTP SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ### Signed-off-by: Matwey V. Kornilov Reviewed-by: Simon Glass --- Changes since v1: - avoid the preprocessor as suggested by Simon Glass lib/tiny-printf.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 8fc7e48d99..89aaa85477 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -9,8 +9,9 @@ */ #include -#include +#include #include +#include #include struct printf_info { @@ -269,20 +270,19 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) } break; case 'p': -#ifdef DEBUG - pointer(info, fmt, va_arg(va, void *)); - /* - * Skip this because it pulls in _ctype which is - * 256 bytes, and we don't generally implement - * pointer anyway - */ - while (isalnum(fmt[0])) - fmt++; - break; -#else + if (CONFIG_IS_ENABLED(NET_SUPPORT) || _DEBUG) { + pointer(info, fmt, va_arg(va, void *)); + /* + * Skip this because it pulls in _ctype which is + * 256 bytes, and we don't generally implement + * pointer anyway + */ + while (isalnum(fmt[0])) + fmt++; + break; + } islong = true; /* no break */ -#endif case 'x': if (islong) { num = va_arg(va, unsigned long);