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: 492272 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp571793jap; Thu, 5 Aug 2021 12:06:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpLaIMJyVZcpKtpbZMvwGG/bYmPZ6C+zcCnkcx5SqdgUMlJmN10V08M9huFdsU4N3cdqR4 X-Received: by 2002:a05:6402:550:: with SMTP id i16mr8542134edx.177.1628190381148; Thu, 05 Aug 2021 12:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628190381; cv=none; d=google.com; s=arc-20160816; b=afmtCLL+lDSb9pkQ6LFASuAuCSWO5RSK6bADdBKiN+DgX/NAKfcqJf8xb3oXyoLVVi V/sPTGTk4XfI05C+WhldCqvJXURH+wZICMmGUW8DSU0kOXeMXuIAyDfVn68RklbA+jBx 6bpsotsrb0eYeoewEiMBPSko86b8omcQDI6DomrqBSsuX5Ftgs21C1hiHQ+lJbnjw8fm uGs7gxhrJu6XBw2kpLU30wJZwke4istmRzsf+RVsYTkbr4T4Q2vDtBa7EiruqcjIna5Q 1a5x6afcCBu5knuBCg3dtWG4odlz6C+zRIYsStMAhmiD9/TyFlAooYP28cBPVbXizFJb 1JlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CzyScuGjDLs6/2gM9OQ33DGDu2+nwBM03ypLx620M9o=; b=WIH+b4sCnPQfpikWPExox5yv4DrQfj8oBuvtJ0eT0njLAkE+cTv/obCYp3gGFJOVEj NbwIxQmJ1iM3DuRZOl1aIs0xpjJELxxZyX9yEsbW4KThaW09X5/3/49tkUlyngL3kLmQ m3ImYAPdz5dabBVVwiQZ38cvU8uvyTgiDGhu27KhxrzNjlJeqPnZe27oSi+bbfXiWTWA BbYTq32IhPxNzjRBibWx28aPVsqf3OdGUudVrit8EpU7pCz6G4NkWb20aTp7SiyZ/9YX Lz1ceyMzpFtM1q6uCbljzsGUe1j5Vp2NK3Ab+KktFFavEXGM2rN8fRxCJs81yxXKqdRY P+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FDaqsY5Y; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id i10si7583647ejd.745.2021.08.05.12.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 12:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FDaqsY5Y; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-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 --- Changes since v1: - avoid the preprocessor as suggested by Simon Glass lib/tiny-printf.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.31.1 Reviewed-by: Simon Glass 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);