summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2020-05-23 16:49:07 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2020-06-18 19:34:40 +0200
commitbd159c6185676c87e4a1cdbb33a869d4c1e05f9e (patch)
tree3531073e11c9dd8769710bb78e40f3ac6cbad5e0 /drivers/net
parentfa9e12102dfc6a5f1f10a75fd1804c16a166ded9 (diff)
downloadu-boot-bd159c6185676c87e4a1cdbb33a869d4c1e05f9e.tar.gz
u-boot-bd159c6185676c87e4a1cdbb33a869d4c1e05f9e.tar.xz
u-boot-bd159c6185676c87e4a1cdbb33a869d4c1e05f9e.zip
net: eepro100: Introduce device private data
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/eepro100.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 532d7aa649..2c25307002 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -201,6 +201,10 @@ static const char i82558_config_cmd[] = {
0x31, 0x05,
};
+struct eepro100_priv {
+ struct eth_device dev;
+};
+
#if defined(CONFIG_E500)
#define bus_to_phys(dev, a) (a)
#define phys_to_bus(dev, a) (a)
@@ -751,6 +755,7 @@ done:
int eepro100_initialize(bd_t *bis)
{
+ struct eepro100_priv *priv;
struct eth_device *dev;
int card_number = 0;
u32 iobase, status;
@@ -785,11 +790,12 @@ int eepro100_initialize(bd_t *bis)
continue;
}
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
+ priv = calloc(1, sizeof(*priv));
+ if (!priv) {
printf("eepro100: Can not allocate memory\n");
break;
}
+ dev = &priv->dev;
sprintf(dev->name, "i82559#%d", card_number);
dev->priv = (void *)devno; /* this have to come before bus_to_phys() */
@@ -804,7 +810,7 @@ int eepro100_initialize(bd_t *bis)
ret = eepro100_initialize_mii(dev);
if (ret) {
eth_unregister(dev);
- free(dev);
+ free(priv);
return ret;
}