summaryrefslogtreecommitdiff
path: root/drivers/net/fec_mxc.c
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2009-12-11 09:47:28 +0100
committerBen Warren <biggerbadderben@gmail.com>2009-12-13 21:55:15 -0800
commitc179a2896e6a5138e30786f1d7961d880dbd6d31 (patch)
treefbd645f1397628a3b03d6d06937ad3c7fcda5f04 /drivers/net/fec_mxc.c
parent2ab4a4d0952b754b1c74f4d2b12b83d600d449c8 (diff)
downloadu-boot-imx-c179a2896e6a5138e30786f1d7961d880dbd6d31.zip
u-boot-imx-c179a2896e6a5138e30786f1d7961d880dbd6d31.tar.gz
u-boot-imx-c179a2896e6a5138e30786f1d7961d880dbd6d31.tar.bz2
fec_mxc: incomplete error handling
fec_init() will only allocate fec->base_ptr if it is non-NULL. But the cleanup routine on error will free the pointer without setting it to NULL. This means that a later call to fec_init() would result in using an invalid pointer. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/fec_mxc.c')
-rw-r--r--drivers/net/fec_mxc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index ad07307..19116f2 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -450,6 +450,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
*/
if (fec_rbd_init(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE) < 0) {
free(fec->base_ptr);
+ fec->base_ptr = NULL;
return -ENOMEM;
}
fec_tbd_init(fec);