diff --git a/lib/os/cbprintf_complete.c b/lib/os/cbprintf_complete.c index 0cdc3b9f46b..206288cb1bb 100644 --- a/lib/os/cbprintf_complete.c +++ b/lib/os/cbprintf_complete.c @@ -1601,6 +1601,26 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp, break; } + case 'p': + /* Implementation-defined: null is "(nil)", non-null + * has 0x prefix followed by significant address hex + * digits, no leading zeros. + */ + if (value->ptr != NULL) { + bps = encode_uint((uintptr_t)value->ptr, conv, + buf, bpe); + + /* Use 0x prefix */ + conv->altform_0c = true; + conv->specifier = 'x'; + + goto prec_int_pad0; + } + + bps = "(nil)"; + bpe = bps + 5; + + break; case 'c': bps = buf; buf[0] = CHAR_IS_SIGNED ? value->sint : value->uint; @@ -1653,26 +1673,6 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp, } } - break; - case 'p': - /* Implementation-defined: null is "(nil)", non-null - * has 0x prefix followed by significant address hex - * digits, no leading zeros. - */ - if (value->ptr != NULL) { - bps = encode_uint((uintptr_t)value->ptr, conv, - buf, bpe); - - /* Use 0x prefix */ - conv->altform_0c = true; - conv->specifier = 'x'; - - goto prec_int_pad0; - } - - bps = "(nil)"; - bpe = bps + 5; - break; case 'n': if (IS_ENABLED(CONFIG_CBPRINTF_N_SPECIFIER)) {