[U-Boot] [PATCH v3 07/14] log: Add an implemention of logging
Simon Glass
sjg at chromium.org
Fri Nov 24 01:49:13 UTC 2017
Hi Lukasz,
On 21 November 2017 at 02:55, Lukasz Majewski <lukma at denx.de> wrote:
>
> On Mon, 20 Nov 2017 15:33:28 -0700
> Simon Glass <sjg at chromium.org> wrote:
>
> > Add the logging header file and implementation with some configuration
> > options to control it.
>
> Despite one question -
>
> Reviewed-by: Lukasz Majewski <lukma at denx.de>
Thanks for looking at this!
>
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v3: None
> > Changes in v2:
> > - Add a comment as to why CONFIG_LOG_MAX_LEVEL is not defined
> > - Drop MAINTAINERS entries for files not added by this patch
> > - Drop the use of 'continue' in the macro
> > - Fix LOG_SPL_MAX_LEVEL typo (should be SPL_LOG_MAX_LEVEL)
> > - Fix up bad use of #if CONFIG_VAL() - use #ifdef instead
> > - Line up log levels with Linux
> >
> > MAINTAINERS | 7 ++
> > common/Kconfig | 56 +++++++++
> > common/Makefile | 1 +
> > common/log.c | 244
> > ++++++++++++++++++++++++++++++++++++++
> > include/asm-generic/global_data.h | 5 +
> > include/log.h | 235
> > ++++++++++++++++++++++++++++++++++++ 6 files changed, 548
> > insertions(+) create mode 100644 common/log.c
> >
[..]
> > + if (cat_list) {
> > + filt->flags |= LOGFF_HAS_CAT;
> > + for (i = 0; ; i++) {
> ^^^^ - I suppose that this is "true"
> Does it comply with any standard (is
> it the undefined behaviour?)
>
> > + if (i == ARRAY_SIZE(filt->cat_list))
> > + return -ENOSPC;
> > + filt->cat_list[i] = cat_list[i];
> > + if (cat_list[i] == LOGC_END)
> > + break;
> > + }
> > + }
This is copying the array over. It is terminated by either LOGC_END or
reaching the end of the array size.
The empty condition means it is a 'forever' loop, except of course
that it will terminate earlier due to the two if()s inside.
Regards,
Simon
More information about the U-Boot
mailing list