net: ethoc: Fix early error paths
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 12 Jul 2016 23:04:35 +0000 (16:04 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:25 +0000 (01:01 +0000)
commitac5ec0900b43db086358fec29cdd9604c9edca54
tree815b9bf5f82e6d48f9655256bf3697ef3c369854
parentf6c84011acd7ae752a08107b503472b30d46b167
net: ethoc: Fix early error paths

commit 386512d18b268c6182903239f9f3390f03ce4c7b upstream.

In case any operation fails before we can successfully go the point
where we would register a MDIO bus, we would be going to an error label
which involves unregistering then freeing this yet to be created MDIO
bus. Update all error paths to go to label free which is the only one
valid until either the clock is enabled, or the MDIO bus is allocated
and registered. This fixes kernel oops observed while trying to
dereference the MDIO bus structure which is not yet allocated.

Fixes: a1702857724f ("net: Add support for the OpenCores 10/100 Mbps Ethernet MAC.")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ethernet/ethoc.c