Skip to contentSkip to conversation

Fix a data abort with fec_imx

PATCH In review Eric Benard 2 participants 2 messages Jan 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a data abort with fec_imx

From: Eric Benard <ebenard@1720eb.(none)>

edev was allocated using malloc. On one board (NOR boot), we met data abort in eth_register (at dev_add_param(dev, &edev->param_ip);). Allocating edev with xzalloc (as in several other drivers) fixed the problem.

---
 drivers/net/fec_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/fec_imx.c +1 -1
index 4893291..49140e7 100644
@@ -542,7 +542,7 @@ static int fec_probe(struct device_d *dev)
 #ifdef CONFIG_ARCH_IMX27
 	PCCR0 |= PCCR0_FEC_EN;
 #endif
-        edev = (struct eth_device *)malloc(sizeof(struct eth_device));
+        edev = (struct eth_device *)xzalloc(sizeof(struct eth_device));
         dev->type_data = edev;
 	fec = (struct fec_priv *)malloc(sizeof(*fec));
         edev->priv = fec;
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#1 lore raw
Quoted 5 lines · Eric Benard

From: Eric Benard <ebenard@1720eb.(none)>

edev was allocated using malloc. On one board (NOR boot), we met data abort in eth_register (at dev_add_param(dev, &edev->param_ip);). Allocating edev with xzalloc (as in several other drivers) fixed the problem.

Ok, applied.

Sascha

Quoted 23 lines
---
 drivers/net/fec_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/fec_imx.c +1 -1
index 4893291..49140e7 100644
@@ -542,7 +542,7 @@ static int fec_probe(struct device_d *dev)
 #ifdef CONFIG_ARCH_IMX27
 	PCCR0 |= PCCR0_FEC_EN;
 #endif
-        edev = (struct eth_device *)malloc(sizeof(struct eth_device));
+        edev = (struct eth_device *)xzalloc(sizeof(struct eth_device));
         dev->type_data = edev;
 	fec = (struct fec_priv *)malloc(sizeof(*fec));
         edev->priv = fec;
Signature · 1 line
1.6.3.3
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox