[U-Boot] [PATCH v1 19/19] net: mvneta: Fix fault when wrong device tree

Stefan Roese sr at denx.de
Wed Mar 21 09:42:50 UTC 2018


On 07.03.2018 22:52, Marek BehĂșn wrote:
> The driver does not check id phy_connect failed (for example on wrong
> property name in device tree). In such a case a fault occurs and the
> CPU is restarted.
> 
> Signed-off-by: Marek Behun <marek.behun at nic.cz>
> ---
>   drivers/net/mvneta.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 83e3153768..7403ccbd3c 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -1554,6 +1554,10 @@ static int mvneta_start(struct udevice *dev)
>   
>   			phydev = phy_connect(pp->bus, pp->phyaddr, dev,
>   					     pp->phy_interface);
> +			if (!phydev) {
> +				printf("phy_connect failed\n");
> +				return -1;
> +			}

Yes. But please add a more meaningful error number here, like -ENODEV.

Other that this:

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan


More information about the U-Boot mailing list