[OpenWrt-Devel] [PATCH v2 1/3] kernel: rtl8366_smi: explicitly set phy addr for switch

Chuanhong Guo gch981213 at gmail.com
Mon Sep 23 04:05:40 EDT 2019


Hi!

On Tue, Aug 27, 2019 at 5:49 PM Serge Vailugin <vasilugin at yandex.ru> wrote:
> [...]
> @@ -1558,6 +1558,14 @@ int rtl8366_smi_probe_of(struct platform_device
> *pdev, struct rtl8366_smi *smi)
>                 goto try_gpio;
>         }
>
> +       of_property_read_u32(np, "phy_id", &smi->phy_id);
> +       if(smi->phy_id < 0) {
> +               smi->phy_id = MDC_REALTEK_PHY_ADDR;
> +       }

When of_property_read_u32 fails, it returns a negative value and leave
destination variable unchanged. You should check return value here
instead.

> +
> +       dev_info(&pdev->dev,
> +               "switch phy addr=%d\n", smi->phy_id);
> +
>         return 0;
>
>   try_gpio:

Regards,
Chuanhong Guo

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list