diff mbox series

tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled

Message ID 20210805124251.4306-1-matwey.kornilov@gmail.com
State New
Headers show
Series tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled | expand

Commit Message

Matwey V. Kornilov Aug. 5, 2021, 12:42 p.m. UTC
%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 <matwey.kornilov@gmail.com>

---
 lib/tiny-printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.31.1

Comments

Simon Glass Aug. 5, 2021, 4:22 p.m. UTC | #1
Hi Matwey,

On Thu, 5 Aug 2021 at 06:43, Matwey V. Kornilov
<matwey.kornilov@gmail.com> wrote:
>

> %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 <matwey.kornilov@gmail.com>

> ---

>  lib/tiny-printf.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c

> index 8fc7e48d99..0b2fabf118 100644

> --- a/lib/tiny-printf.c

> +++ b/lib/tiny-printf.c

> @@ -269,7 +269,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)

>                                 }

>                                 break;

>                         case 'p':

> -#ifdef DEBUG

> +#if IS_ENABLED(CONFIG_SPL_NET_SUPPORT) || defined(DEBUG)

>                                 pointer(info, fmt, va_arg(va, void *));

>                                 /*

>                                  * Skip this because it pulls in _ctype which is

> --

> 2.31.1

>


Reviewed-by: Simon Glass <sjg@chromium.org>


But can you try something like:

case 'p':
if (CONFIG_IS_ENABLED(NET_SUPPORT) || _DEBUG) {
   ...
}

instead? Will need to include log-h though. We try to avoid the preprocessor.

Regards,
Simon
diff mbox series

Patch

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 8fc7e48d99..0b2fabf118 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -269,7 +269,7 @@  static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
 				}
 				break;
 			case 'p':
-#ifdef DEBUG
+#if IS_ENABLED(CONFIG_SPL_NET_SUPPORT) || defined(DEBUG)
 				pointer(info, fmt, va_arg(va, void *));
 				/*
 				 * Skip this because it pulls in _ctype which is