Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fsl/fman: fix error return code in mac_probe()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 3933961682a3 ("fsl/fman: Add FMan MAC driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wei Yongjun and committed by
David S. Miller
3f3177bb a0e65de7

+6 -2
+6 -2
drivers/net/ethernet/freescale/fman/mac.c
··· 879 879 880 880 priv->fixed_link = kzalloc(sizeof(*priv->fixed_link), 881 881 GFP_KERNEL); 882 - if (!priv->fixed_link) 882 + if (!priv->fixed_link) { 883 + err = -ENOMEM; 883 884 goto _return_dev_set_drvdata; 885 + } 884 886 885 887 priv->phy_node = of_node_get(mac_node); 886 888 phy = of_phy_find_device(priv->phy_node); 887 - if (!phy) 889 + if (!phy) { 890 + err = -EINVAL; 888 891 goto _return_dev_set_drvdata; 892 + } 889 893 890 894 priv->fixed_link->link = phy->link; 891 895 priv->fixed_link->speed = phy->speed;