All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] board/Marvell/DB64360
@ 2011-01-24 19:27 Tim Liu
  2011-01-24 19:50 ` Prafulla Wadaskar
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Liu @ 2011-01-24 19:27 UTC (permalink / raw
  To: u-boot

Hi,  

 

I am new to the list, any info.  Or help is appreciated!

 

I went through C code of Ethernet initialization of U-boot(version
u-boot-2010_09.tar.gz ) in the board of db64360 under the board name
Marvell and found that there maybe is an obvious coding error in the
function void mv64360_eth_initialize(bd_t *bis) located in mv_eth.c. The
line is underscored. 

The line should be:   port_private = calloc (sizeof (struct
mv64360_eth_priv), 1), because it make next line pointless:
ethernet_private->port_private = (void *)port_private;
ethernet_private->port_private should point to mv64360_eth_priv, but
actually point to (*ethernet_private)ETH_PORT_INFO in the code.

 

Thanks

 

 

Tim Liu

 

 

Code snippet from mv64360_eth_initialize:

 

      ethernet_private = calloc (sizeof (*ethernet_private), 1);

            dev->priv = (void *) ethernet_private;

 

            if (!ethernet_private) {

                  printf ("%s: %s allocation failure, %s\n",

                        __FUNCTION__, dev->name,

                        "Private Device Structure");

                  free (dev);

                  return;

            }

            /* start with an zeroed ETH_PORT_INFO */

            memset (ethernet_private, 0, sizeof (ETH_PORT_INFO));

            memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);

 

            /* set pointer to memory for stats data structure etc... */

            port_private = calloc (sizeof (*ethernet_private), 1);
//should be sizeof (struct mv64360_eth_priv)

            ethernet_private->port_private = (void *)port_private;

            if (!port_private) {

                  printf ("%s: %s allocation failure, %s\n",

                        __FUNCTION__, dev->name,

                        "Port Private Device Structure");

 

                  free (ethernet_private);

                  free (dev);

                  return;

            }

 

            port_private->stats =

                  calloc (sizeof (struct net_device_stats), 1);

            if (!port_private->stats) {

                  printf ("%s: %s allocation failure, %s\n",

                        __FUNCTION__, dev->name,

                        "Net stat Structure");

 

                  free (port_private);

                  free (ethernet_private);

                  free (dev);

                  return;

            }

            memset (ethernet_private->port_private, 0,

                  sizeof (struct mv64360_eth_priv));

 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot] board/Marvell/DB64360
  2011-01-24 19:27 [U-Boot] board/Marvell/DB64360 Tim Liu
@ 2011-01-24 19:50 ` Prafulla Wadaskar
  0 siblings, 0 replies; 2+ messages in thread
From: Prafulla Wadaskar @ 2011-01-24 19:50 UTC (permalink / raw
  To: u-boot



> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de]
> On Behalf Of Tim Liu
> Sent: Monday, January 24, 2011 11:27 AM
> To: u-boot at lists.denx.de
> Subject: Re: [U-Boot] board/Marvell/DB64360
> 
> Hi,
> 
> 
> 
> I am new to the list, any info.  Or help is appreciated!
> 
> 
> 
> I went through C code of Ethernet initialization of U-boot(version
> u-boot-2010_09.tar.gz ) in the board of db64360 under the board name
> Marvell and found that there maybe is an obvious coding error in the
> function void mv64360_eth_initialize(bd_t *bis) located in mv_eth.c. The
> line is underscored.
> 
> The line should be:   port_private = calloc (sizeof (struct
> mv64360_eth_priv), 1), because it make next line pointless:
> ethernet_private->port_private = (void *)port_private;
> ethernet_private->port_private should point to mv64360_eth_priv, but
> actually point to (*ethernet_private)ETH_PORT_INFO in the code.
>

This is a very old board support and not up to the mark (maintained).
I don't have hardware, if there are no users, we can remove it's support.

Copying Josh (Maintainer of this board)

Hi Josh
What do you think?

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 19:27 [U-Boot] board/Marvell/DB64360 Tim Liu
2011-01-24 19:50 ` Prafulla Wadaskar

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.