All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Robinson <pbrobinson@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCHv2 2/2] stdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly
Date: Thu, 3 May 2018 15:12:47 +0100	[thread overview]
Message-ID: <CALeDE9Np_SRx409sdYoE=KG3rmaFwLhMrB5PbeE=XWJ3+hF-3g@mail.gmail.com> (raw)
In-Reply-To: <1525353146-21994-2-git-send-email-trini@konsulko.com>

On Thu, May 3, 2018 at 2:12 PM, Tom Rini <trini@konsulko.com> wrote:
> With tighter build flags the fact that <stdio_dev.h> doesn't have a
> reference back to MAX_NAMES causes an error.  Include <stdio.h> here and
> then in common/console.c use MAX_NAMES rather than 3 when working with
> stdio_names.
>
> Reported-by: Peter Robinson <pbrobinson@gmail.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Changes in v2:
> - New patch
> ---
>  common/console.c    | 4 ++--
>  include/stdio_dev.h | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/console.c b/common/console.c
> index 0e0295514b21..f1a5e95c8f39 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -847,7 +847,7 @@ done:
>
>  #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
>         /* set the environment variables (will overwrite previous env settings) */
> -       for (i = 0; i < 3; i++) {
> +       for (i = 0; i < MAX_NAMES; i++) {

I think you mean MAX_FILES? With MAX_NAMES it fails, with MAX_FILES it builds.

With the that change, if it's correct:
Tested-by: Peter Robinson <pbrobinson@gmail.com>

>                 env_set(stdio_names[i], stdio_devices[i]->name);
>         }
>  #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
> @@ -926,7 +926,7 @@ int console_init_r(void)
>  #endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
>
>         /* Setting environment variables */
> -       for (i = 0; i < 3; i++) {
> +       for (i = 0; i < MAX_NAMES; i++) {
>                 env_set(stdio_names[i], stdio_devices[i]->name);
>         }
>
> diff --git a/include/stdio_dev.h b/include/stdio_dev.h
> index 1ea8bff47bab..c2a88b4fc416 100644
> --- a/include/stdio_dev.h
> +++ b/include/stdio_dev.h
> @@ -8,6 +8,7 @@
>  #ifndef _STDIO_DEV_H_
>  #define _STDIO_DEV_H_
>
> +#include <stdio.h>
>  #include <linux/list.h>
>
>  /*
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

  reply	other threads:[~2018-05-03 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 13:12 [U-Boot] [PATCHv2 1/2] stdio_dev.h: Drop the video section as it is unused Tom Rini
2018-05-03 13:12 ` [U-Boot] [PATCHv2 2/2] stdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly Tom Rini
2018-05-03 14:12   ` Peter Robinson [this message]
2018-05-03 20:21     ` Tom Rini
2018-05-06 21:12   ` [U-Boot] [U-Boot, PATCHv2, " Tom Rini
2018-05-06 21:12 ` [U-Boot] [U-Boot, PATCHv2, 1/2] stdio_dev.h: Drop the video section as it is unused Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALeDE9Np_SRx409sdYoE=KG3rmaFwLhMrB5PbeE=XWJ3+hF-3g@mail.gmail.com' \
    --to=pbrobinson@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.