Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: LGPL-2.1+ |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Tiny printf version for SPL |
| 4 | * |
| 5 | * Copied from: |
| 6 | * http://www.sparetimelabs.com/printfrevisited/printfrevisited.php |
| 7 | * |
| 8 | * Copyright (C) 2004,2008 Kustaa Nyholm |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <stdarg.h> |
| 13 | #include <serial.h> |
Vignesh R | 0bda3e4 | 2017-04-10 12:23:22 +0530 | [diff] [blame] | 14 | #include <linux/ctype.h> |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 15 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 16 | struct printf_info { |
| 17 | char *bf; /* Digit buffer */ |
| 18 | char zs; /* non-zero if a digit has been written */ |
| 19 | char *outstr; /* Next output position for sprintf() */ |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 20 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 21 | /* Output a character */ |
| 22 | void (*putc)(struct printf_info *info, char ch); |
| 23 | }; |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 24 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 25 | static void out(struct printf_info *info, char c) |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 26 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 27 | *info->bf++ = c; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 28 | } |
| 29 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 30 | static void out_dgt(struct printf_info *info, char dgt) |
| 31 | { |
| 32 | out(info, dgt + (dgt < 10 ? '0' : 'a' - 10)); |
| 33 | info->zs = 1; |
| 34 | } |
| 35 | |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 36 | static void div_out(struct printf_info *info, unsigned long *num, |
| 37 | unsigned long div) |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 38 | { |
| 39 | unsigned char dgt = 0; |
| 40 | |
Stefan Roese | 26a552c | 2015-11-16 15:26:34 +0100 | [diff] [blame] | 41 | while (*num >= div) { |
| 42 | *num -= div; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 43 | dgt++; |
| 44 | } |
| 45 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 46 | if (info->zs || dgt > 0) |
| 47 | out_dgt(info, dgt); |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 48 | } |
| 49 | |
Vignesh R | 0bda3e4 | 2017-04-10 12:23:22 +0530 | [diff] [blame] | 50 | #ifdef CONFIG_SPL_NET_SUPPORT |
| 51 | static void string(struct printf_info *info, char *s) |
| 52 | { |
| 53 | char ch; |
| 54 | |
| 55 | while ((ch = *s++)) |
| 56 | out(info, ch); |
| 57 | } |
| 58 | |
| 59 | static const char hex_asc[] = "0123456789abcdef"; |
| 60 | #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] |
| 61 | #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] |
| 62 | |
| 63 | static inline char *pack_hex_byte(char *buf, u8 byte) |
| 64 | { |
| 65 | *buf++ = hex_asc_hi(byte); |
| 66 | *buf++ = hex_asc_lo(byte); |
| 67 | return buf; |
| 68 | } |
| 69 | |
| 70 | static void mac_address_string(struct printf_info *info, u8 *addr, |
| 71 | bool separator) |
| 72 | { |
| 73 | /* (6 * 2 hex digits), 5 colons and trailing zero */ |
| 74 | char mac_addr[6 * 3]; |
| 75 | char *p = mac_addr; |
| 76 | int i; |
| 77 | |
| 78 | for (i = 0; i < 6; i++) { |
| 79 | p = pack_hex_byte(p, addr[i]); |
| 80 | if (separator && i != 5) |
| 81 | *p++ = ':'; |
| 82 | } |
| 83 | *p = '\0'; |
| 84 | |
| 85 | string(info, mac_addr); |
| 86 | } |
| 87 | |
| 88 | static char *put_dec_trunc(char *buf, unsigned int q) |
| 89 | { |
| 90 | unsigned int d3, d2, d1, d0; |
| 91 | d1 = (q >> 4) & 0xf; |
| 92 | d2 = (q >> 8) & 0xf; |
| 93 | d3 = (q >> 12); |
| 94 | |
| 95 | d0 = 6 * (d3 + d2 + d1) + (q & 0xf); |
| 96 | q = (d0 * 0xcd) >> 11; |
| 97 | d0 = d0 - 10 * q; |
| 98 | *buf++ = d0 + '0'; /* least significant digit */ |
| 99 | d1 = q + 9 * d3 + 5 * d2 + d1; |
| 100 | if (d1 != 0) { |
| 101 | q = (d1 * 0xcd) >> 11; |
| 102 | d1 = d1 - 10 * q; |
| 103 | *buf++ = d1 + '0'; /* next digit */ |
| 104 | |
| 105 | d2 = q + 2 * d2; |
| 106 | if ((d2 != 0) || (d3 != 0)) { |
| 107 | q = (d2 * 0xd) >> 7; |
| 108 | d2 = d2 - 10 * q; |
| 109 | *buf++ = d2 + '0'; /* next digit */ |
| 110 | |
| 111 | d3 = q + 4 * d3; |
| 112 | if (d3 != 0) { |
| 113 | q = (d3 * 0xcd) >> 11; |
| 114 | d3 = d3 - 10 * q; |
| 115 | *buf++ = d3 + '0'; /* next digit */ |
| 116 | if (q != 0) |
| 117 | *buf++ = q + '0'; /* most sign. digit */ |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | return buf; |
| 122 | } |
| 123 | |
| 124 | static void ip4_addr_string(struct printf_info *info, u8 *addr) |
| 125 | { |
| 126 | /* (4 * 3 decimal digits), 3 dots and trailing zero */ |
| 127 | char ip4_addr[4 * 4]; |
| 128 | char temp[3]; /* hold each IP quad in reverse order */ |
| 129 | char *p = ip4_addr; |
| 130 | int i, digits; |
| 131 | |
| 132 | for (i = 0; i < 4; i++) { |
| 133 | digits = put_dec_trunc(temp, addr[i]) - temp; |
| 134 | /* reverse the digits in the quad */ |
| 135 | while (digits--) |
| 136 | *p++ = temp[digits]; |
| 137 | if (i != 3) |
| 138 | *p++ = '.'; |
| 139 | } |
| 140 | *p = '\0'; |
| 141 | |
| 142 | string(info, ip4_addr); |
| 143 | } |
| 144 | #endif |
| 145 | |
| 146 | /* |
| 147 | * Show a '%p' thing. A kernel extension is that the '%p' is followed |
| 148 | * by an extra set of characters that are extended format |
| 149 | * specifiers. |
| 150 | * |
| 151 | * Right now we handle: |
| 152 | * |
| 153 | * - 'M' For a 6-byte MAC address, it prints the address in the |
| 154 | * usual colon-separated hex notation. |
| 155 | * - 'm' Same as above except there is no colon-separator. |
| 156 | * - 'I4'for IPv4 addresses printed in the usual way (dot-separated |
| 157 | * decimal). |
| 158 | */ |
| 159 | |
| 160 | static void pointer(struct printf_info *info, const char *fmt, void *ptr) |
| 161 | { |
| 162 | #ifdef DEBUG |
| 163 | unsigned long num = (uintptr_t)ptr; |
| 164 | unsigned long div; |
| 165 | #endif |
| 166 | |
| 167 | switch (*fmt) { |
| 168 | #ifdef DEBUG |
| 169 | case 'a': |
| 170 | |
| 171 | switch (fmt[1]) { |
| 172 | case 'p': |
| 173 | default: |
| 174 | num = *(phys_addr_t *)ptr; |
| 175 | break; |
| 176 | } |
| 177 | break; |
| 178 | #endif |
| 179 | #ifdef CONFIG_SPL_NET_SUPPORT |
| 180 | case 'm': |
| 181 | return mac_address_string(info, ptr, false); |
| 182 | case 'M': |
| 183 | return mac_address_string(info, ptr, true); |
| 184 | case 'I': |
| 185 | if (fmt[1] == '4') |
| 186 | return ip4_addr_string(info, ptr); |
| 187 | #endif |
| 188 | default: |
| 189 | break; |
| 190 | } |
| 191 | #ifdef DEBUG |
| 192 | div = 1UL << (sizeof(long) * 8 - 4); |
| 193 | for (; div; div /= 0x10) |
| 194 | div_out(info, &num, div); |
| 195 | #endif |
| 196 | } |
| 197 | |
Masahiro Yamada | c1cb800 | 2017-02-12 18:08:43 +0900 | [diff] [blame] | 198 | static int _vprintf(struct printf_info *info, const char *fmt, va_list va) |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 199 | { |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 200 | char ch; |
| 201 | char *p; |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 202 | unsigned long num; |
Stefan Roese | 26a552c | 2015-11-16 15:26:34 +0100 | [diff] [blame] | 203 | char buf[12]; |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 204 | unsigned long div; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 205 | |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 206 | while ((ch = *(fmt++))) { |
| 207 | if (ch != '%') { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 208 | info->putc(info, ch); |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 209 | } else { |
Simon Glass | b5afcad | 2016-05-14 14:02:52 -0600 | [diff] [blame] | 210 | bool lz = false; |
| 211 | int width = 0; |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 212 | bool islong = false; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 213 | |
| 214 | ch = *(fmt++); |
Andre Przywara | 7b303b8 | 2017-01-02 11:48:29 +0000 | [diff] [blame] | 215 | if (ch == '-') |
| 216 | ch = *(fmt++); |
| 217 | |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 218 | if (ch == '0') { |
| 219 | ch = *(fmt++); |
| 220 | lz = 1; |
| 221 | } |
| 222 | |
| 223 | if (ch >= '0' && ch <= '9') { |
Simon Glass | b5afcad | 2016-05-14 14:02:52 -0600 | [diff] [blame] | 224 | width = 0; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 225 | while (ch >= '0' && ch <= '9') { |
Simon Glass | b5afcad | 2016-05-14 14:02:52 -0600 | [diff] [blame] | 226 | width = (width * 10) + ch - '0'; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 227 | ch = *fmt++; |
| 228 | } |
| 229 | } |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 230 | if (ch == 'l') { |
| 231 | ch = *(fmt++); |
| 232 | islong = true; |
| 233 | } |
| 234 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 235 | info->bf = buf; |
| 236 | p = info->bf; |
| 237 | info->zs = 0; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 238 | |
| 239 | switch (ch) { |
Simon Glass | b5afcad | 2016-05-14 14:02:52 -0600 | [diff] [blame] | 240 | case '\0': |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 241 | goto abort; |
| 242 | case 'u': |
| 243 | case 'd': |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 244 | div = 1000000000; |
| 245 | if (islong) { |
| 246 | num = va_arg(va, unsigned long); |
| 247 | if (sizeof(long) > 4) |
| 248 | div *= div * 10; |
| 249 | } else { |
| 250 | num = va_arg(va, unsigned int); |
| 251 | } |
| 252 | |
| 253 | if (ch == 'd') { |
| 254 | if (islong && (long)num < 0) { |
| 255 | num = -(long)num; |
| 256 | out(info, '-'); |
| 257 | } else if (!islong && (int)num < 0) { |
| 258 | num = -(int)num; |
| 259 | out(info, '-'); |
| 260 | } |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 261 | } |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 262 | if (!num) { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 263 | out_dgt(info, 0); |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 264 | } else { |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 265 | for (; div; div /= 10) |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 266 | div_out(info, &num, div); |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 267 | } |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 268 | break; |
| 269 | case 'x': |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 270 | if (islong) { |
| 271 | num = va_arg(va, unsigned long); |
| 272 | div = 1UL << (sizeof(long) * 8 - 4); |
| 273 | } else { |
| 274 | num = va_arg(va, unsigned int); |
| 275 | div = 0x10000000; |
| 276 | } |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 277 | if (!num) { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 278 | out_dgt(info, 0); |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 279 | } else { |
Andre Przywara | 3211868 | 2017-01-02 11:48:28 +0000 | [diff] [blame] | 280 | for (; div; div /= 0x10) |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 281 | div_out(info, &num, div); |
Simon Glass | bdfb70b | 2016-01-05 09:30:57 -0700 | [diff] [blame] | 282 | } |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 283 | break; |
| 284 | case 'c': |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 285 | out(info, (char)(va_arg(va, int))); |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 286 | break; |
| 287 | case 's': |
| 288 | p = va_arg(va, char*); |
| 289 | break; |
Vignesh R | 0bda3e4 | 2017-04-10 12:23:22 +0530 | [diff] [blame] | 290 | case 'p': |
| 291 | pointer(info, fmt, va_arg(va, void *)); |
| 292 | while (isalnum(fmt[0])) |
| 293 | fmt++; |
| 294 | break; |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 295 | case '%': |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 296 | out(info, '%'); |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 297 | default: |
| 298 | break; |
| 299 | } |
| 300 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 301 | *info->bf = 0; |
| 302 | info->bf = p; |
| 303 | while (*info->bf++ && width > 0) |
Simon Glass | b5afcad | 2016-05-14 14:02:52 -0600 | [diff] [blame] | 304 | width--; |
| 305 | while (width-- > 0) |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 306 | info->putc(info, lz ? '0' : ' '); |
Simon Glass | 5bd9f6c | 2015-12-29 05:22:46 -0700 | [diff] [blame] | 307 | if (p) { |
| 308 | while ((ch = *p++)) |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 309 | info->putc(info, ch); |
Simon Glass | 5bd9f6c | 2015-12-29 05:22:46 -0700 | [diff] [blame] | 310 | } |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 311 | } |
| 312 | } |
| 313 | |
| 314 | abort: |
Stefan Roese | 363ab7b | 2015-11-23 07:00:22 +0100 | [diff] [blame] | 315 | return 0; |
| 316 | } |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 317 | |
Alex Kiernan | d07d0a0 | 2018-04-19 04:32:55 +0000 | [diff] [blame] | 318 | #if CONFIG_IS_ENABLED(PRINTF) |
| 319 | static void putc_normal(struct printf_info *info, char ch) |
| 320 | { |
| 321 | putc(ch); |
| 322 | } |
| 323 | |
Hans de Goede | 5f18398 | 2016-06-10 21:03:34 +0200 | [diff] [blame] | 324 | int vprintf(const char *fmt, va_list va) |
| 325 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 326 | struct printf_info info; |
| 327 | |
| 328 | info.putc = putc_normal; |
| 329 | return _vprintf(&info, fmt, va); |
Hans de Goede | 5f18398 | 2016-06-10 21:03:34 +0200 | [diff] [blame] | 330 | } |
| 331 | |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 332 | int printf(const char *fmt, ...) |
| 333 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 334 | struct printf_info info; |
| 335 | |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 336 | va_list va; |
| 337 | int ret; |
| 338 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 339 | info.putc = putc_normal; |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 340 | va_start(va, fmt); |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 341 | ret = _vprintf(&info, fmt, va); |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 342 | va_end(va); |
| 343 | |
| 344 | return ret; |
| 345 | } |
Alex Kiernan | d07d0a0 | 2018-04-19 04:32:55 +0000 | [diff] [blame] | 346 | #endif |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 347 | |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 348 | static void putc_outstr(struct printf_info *info, char ch) |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 349 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 350 | *info->outstr++ = ch; |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 351 | } |
| 352 | |
Marek Vasut | 8dc095b | 2016-05-31 23:12:46 +0200 | [diff] [blame] | 353 | int sprintf(char *buf, const char *fmt, ...) |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 354 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 355 | struct printf_info info; |
Simon Glass | 49138f8 | 2016-05-14 14:02:53 -0600 | [diff] [blame] | 356 | va_list va; |
| 357 | int ret; |
| 358 | |
| 359 | va_start(va, fmt); |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 360 | info.outstr = buf; |
| 361 | info.putc = putc_outstr; |
| 362 | ret = _vprintf(&info, fmt, va); |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 363 | va_end(va); |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 364 | *info.outstr = '\0'; |
Sjoerd Simons | 1168ed5 | 2015-12-04 23:27:37 +0100 | [diff] [blame] | 365 | |
| 366 | return ret; |
| 367 | } |
Marek Vasut | 8dc095b | 2016-05-31 23:12:46 +0200 | [diff] [blame] | 368 | |
| 369 | /* Note that size is ignored */ |
| 370 | int snprintf(char *buf, size_t size, const char *fmt, ...) |
| 371 | { |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 372 | struct printf_info info; |
Marek Vasut | 8dc095b | 2016-05-31 23:12:46 +0200 | [diff] [blame] | 373 | va_list va; |
| 374 | int ret; |
| 375 | |
| 376 | va_start(va, fmt); |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 377 | info.outstr = buf; |
| 378 | info.putc = putc_outstr; |
| 379 | ret = _vprintf(&info, fmt, va); |
Marek Vasut | 8dc095b | 2016-05-31 23:12:46 +0200 | [diff] [blame] | 380 | va_end(va); |
Simon Glass | 5958cbe | 2016-08-04 21:58:14 -0600 | [diff] [blame] | 381 | *info.outstr = '\0'; |
Marek Vasut | 8dc095b | 2016-05-31 23:12:46 +0200 | [diff] [blame] | 382 | |
| 383 | return ret; |
| 384 | } |