[U-Boot] [PATCH] cs8900 assign dev->priv before using it
Ben Warren
biggerbadderben at gmail.com
Thu Oct 29 18:05:05 CET 2009
Hello Hui,
Hui.Tang wrote:
> cs8900_get_enetaddr() call get_reg_init_bus(), which will use dev->priv in CONFIG_CS8900_BUS16 config, so we should assign dev->priv before using it.
>
> ---
> drivers/net/cs8900.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
> index 587f7f6..962b74c 100644
> --- a/drivers/net/cs8900.c
> +++ b/drivers/net/cs8900.c
> @@ -320,12 +320,12 @@ int cs8900_initialize(u8 dev_num, int base_addr)
> }
> memset(priv, 0, sizeof(*priv));
> priv->regs = (struct cs8900_regs *)base_addr;
> + dev->priv = priv;
>
> /* Load MAC address from EEPROM */
> cs8900_get_enetaddr(dev);
>
> dev->iobase = base_addr;
> - dev->priv = priv;
> dev->init = cs8900_init;
> dev->halt = cs8900_halt;
> dev->send = cs8900_send;
>
Thanks for catching this. I'd prefer to move the
'cs8900_get_enetaddr() call to below all the function pointer
assignments. In the interest of getting this bug fix in the current
release, I'll just modify your patch and apply it.
Next time please remember your signed-off-by line.
regards,
Ben
More information about the U-Boot
mailing list