[PATCH 1/2] net: fec: Don't use disabled phys

Sean Anderson sean.anderson at seco.com
Thu Apr 15 18:50:23 CEST 2021



On 4/8/21 5:10 PM, Sean Anderson wrote:
> If a phy is disabled, don't use it. This matches Linux's behavior.
> 
> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
> ---
> 
>   drivers/net/fec_mxc.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index ec21157d71..37eb894248 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -1299,15 +1299,18 @@ static const struct eth_ops fecmxc_ops = {
>   static int device_get_phy_addr(struct fec_priv *priv, struct udevice *dev)
>   {
>   	struct ofnode_phandle_args phandle_args;
> -	int reg;
> +	int reg, ret;
>   
> -	if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
> -				       &phandle_args)) {
> -		debug("Failed to find phy-handle");
> -		return -ENODEV;
> +	ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
> +					 &phandle_args);
> +	if (ret) {
> +		debug("Failed to find phy-handle (err = %d\n)");

This is missing the ret parameter; will send a v2.

--Sean

> +		return ret;
>   	}
>   
>   	priv->phy_of_node = phandle_args.node;
> +	if (!ofnode_is_available(phandle_args.node))
> +		return -ENOENT;
>   
>   	reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
>   
> 


More information about the U-Boot mailing list