net: ll_temac: Fix and simplify error handling by using devres functions
authorEsben Haabendal <esben@geanix.com>
Tue, 30 Apr 2019 07:17:48 +0000 (09:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 18:33:30 +0000 (14:33 -0400)
commita63625d2a0e794f9a348a7119e50b0a56cbd6a18
tree291d69d25d2f87093c62a1d586a4467db21ab9ae
parentac97a359b72d340e1c04083451b1c6d2f41eb317
net: ll_temac: Fix and simplify error handling by using devres functions

As a side effect, a few error cases are fixed.

If of_iomap() of sdma_regs failed, no error code was returned.  Fixed to
return -ENOMEM similar to of_iomap() fail of regs.

If sysfs_create_group() or register_netdev() failed, lp->phy_node was not
released.

Finally, the order in remove function is corrected to be reverse order
of what is done in probe, i.e. calling temac_mdio_teardown() last, so we
unregister the netdev that most likely is using the mdio_bus first.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/ll_temac.h
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/ethernet/xilinx/ll_temac_mdio.c