net: ll_temac: Return actual error from of_get_mac_address()
PATCH v2 1/1 net: ll_temac: Return actual error from of_get_mac_address()
When of_get_mac_address() fails, return the actual error code (rc) instead of the hardcoded -ENODEV. This preserves the original error information, which may be more specific (e.g., -EINVAL, -EPROBE_DEFER) and helps callers handle the failure appropriately.
Use dev_err_probe() to avoid printing an extra error message in case of -EPROBE_DEFER.
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/xilinx/ll_temac_main.c +2 -4
@@ -1579,10 +1579,8 @@ static int temac_probe(struct platform_device *pdev)if (temac_np) {/* Retrieve the MAC address */ rc =of_get_mac_address (temac_np, addr); -if (rc) { -dev_err (&pdev->dev,"could not find MAC address\n" ); -return -ENODEV ; - } +if (rc) +return dev_err (&pdev->dev, rc,"could not find MAC address\n" );temac_init_mac_address (ndev, addr); }else if (pdata) {temac_init_mac_address (ndev, pdata->mac_addr);
Signature · 1 line
2.55.0
Quoted 11 lines · Rosen Penev
When
of_get_mac_address()fails, return the actual error code (rc) instead of the hardcoded-ENODEV. This preserves the original error information, which may be more specific (e.g.,-EINVAL, -EPROBE_DEFER) and helps callers handle the failure appropriately.Use
dev_err_probe()to avoid printing an extra error message in case of -EPROBE_DEFER.Fixes 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>
Does this bother anybody? Have you seen the extra error message?
Maybe net-next would be a better target.
Andrew