]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: dwmac-sun8i: Fix probe error handling
authorSamuel Holland <samuel@sholland.org>
Sun, 3 Jan 2021 11:17:41 +0000 (05:17 -0600)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Jan 2021 00:32:07 +0000 (16:32 -0800)
commite7204f1800b2ff4963ef9fc45cb2af4635fea18c
treeddb1a052f3bdb6dbaec456ea828bd4660cdfbefe
parent93bcf53acaad0bcec30177459f19b60cc30597af
net: stmmac: dwmac-sun8i: Fix probe error handling

stmmac_pltfr_remove does three things in one function, making it
inapproprate for unwinding the steps in the probe function. Currently,
a failure before the call to stmmac_dvr_probe would leak OF node
references due to missing a call to stmmac_remove_config_dt. And an
error in stmmac_dvr_probe would cause the driver to attempt to remove a
netdevice that was never added. Fix these by reordering the init and
splitting out the error handling steps.

Fixes: 3a69638775ff ("net-next: stmmac: Add dwmac-sun8i")
Fixes: 6435786efb38 ("net: ethernet: dwmac-sun8i: Use the correct function in exit path")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c