]> git.sur5r.net Git - u-boot/commitdiff
fec_mxc: incomplete error handling
authorJohn Ogness <john.ogness@linutronix.de>
Fri, 11 Dec 2009 08:47:28 +0000 (09:47 +0100)
committerBen Warren <biggerbadderben@gmail.com>
Mon, 14 Dec 2009 05:55:15 +0000 (21:55 -0800)
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>
drivers/net/fec_mxc.c

index ad073077cf12d9314797c643fa2df51614c17cb5..19116f253ab0233cd47640d8ae4ef11189c85310 100644 (file)
@@ -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);