
On 28 December 2016 at 00:36, Oded Gabbay oded.gabbay@gmail.com wrote:
In the tiny-printf implementation, there is no support for %.*s. This patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different debug statement which doesn't use %.*s
Signed-off-by: Oded Gabbay oded.gabbay@gmail.com Cc: Simon Glass sjg@chromium.org
common/spl/spl.c | 5 +++++ 1 file changed, 5 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
I did consider whether we should have some #defines for this (one which expands to either "*" or "" and one which drops the (int) parameter when USE_TINY_PRINTF is enabled), but it might be a bit clumsy.
I think what you have is the simplest solution for now.
diff --git a/common/spl/spl.c b/common/spl/spl.c index f7df834..7c4744d 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -115,9 +115,14 @@ int spl_parse_image_header(struct spl_image_info *spl_image, } spl_image->os = image_get_os(header); spl_image->name = image_get_name(header); +#ifdef CONFIG_USE_TINY_PRINTF
debug("spl: payload image: %s load addr: 0x%x size: %d\n",
spl_image->name, spl_image->load_addr, spl_image->size);
+#else debug("spl: payload image: %.*s load addr: 0x%x size: %d\n", (int)sizeof(spl_image->name), spl_image->name, spl_image->load_addr, spl_image->size); +#endif } else { #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE /* -- 2.7.4