public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 03/31] netloop: speed up NetLoop
Date: Wed, 28 Jan 2009 20:09:31 -0600	[thread overview]
Message-ID: <20090128200931.d04cab36.kim.phillips@freescale.com> (raw)
In-Reply-To: <498027A2.8060104@denx.de>

On Wed, 28 Jan 2009 10:38:42 +0100
Heiko Schocher <hs@denx.de> wrote:

> +++ b/common/cmd_nvedit.c
> @@ -75,7 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
>  static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
>  #define	N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
> 
> +static int env_id = 1;
> 
> +int get_env_id (void)
> +{
> +	return env_id;
> +}

does getting env_id really need be a function?

> diff --git a/net/eth.c b/net/eth.c
> index b7ef09f..d1d73cb 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -28,7 +28,11 @@
> 
>  #if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
> 
> +static char *act = 0;
> +static int  env_changed_id = 0;
> +
>  /*
> +*

please don't mess with the already good comment coding style.

>   * CPU and board-specific Ethernet initializations.  Aliased function
>   * signals caller to move on
>   */
> @@ -439,13 +443,16 @@ void eth_try_another(int first_restart)
>  #ifdef CONFIG_NET_MULTI
>  void eth_set_current(void)
>  {
> -	char *act;
>  	struct eth_device* old_current;
> 
>  	if (!eth_current)	/* XXX no current */
>  		return;
> 
> -	act = getenv("ethact");
> +	if ((*act == 0) || (env_changed_id < get_env_id()))

If I'm not mistaken, this will unintentionally dereference address 0
the first time this is executed.

> +	{
> +		act = getenv("ethact");
> +		env_changed_id = get_env_id();
> +	}
>  	if (act != NULL) {
>  		old_current = eth_current;
>  		do {

Kim

  parent reply	other threads:[~2009-01-29  2:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28  9:38 [U-Boot] [PATCH 03/31] netloop: speed up NetLoop Heiko Schocher
2009-01-28 11:42 ` Wolfgang Denk
2009-01-28 11:55   ` Heiko Schocher
2009-01-29  2:09 ` Kim Phillips [this message]
2009-01-29  9:01   ` Heiko Schocher

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=20090128200931.d04cab36.kim.phillips@freescale.com \
    --to=kim.phillips@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox