[PATCH v1 3/6] net: mv88e61xx: Clear temporary structs before using them in get_phy_id()
Marek Vasut
marek.vasut at mailbox.org
Thu Jun 1 12:36:27 CEST 2023
On 6/1/23 12:00, Lukasz Majewski wrote:
> Those automatically created structures can have random value.
> However, mv88e61xx driver assumes that those are zeroed.
>
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
> Reviewed-by: Ramon Fried <rfried.dev at gmail.com>
> ---
>
> drivers/net/phy/mv88e61xx.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c
> index 4aee83551beb..c19c3dfa8b6d 100644
> --- a/drivers/net/phy/mv88e61xx.c
> +++ b/drivers/net/phy/mv88e61xx.c
> @@ -1213,6 +1213,10 @@ int get_phy_id(struct mii_dev *bus, int smi_addr, int devad, u32 *phy_id)
> struct mii_dev temp_mii;
> int val;
>
> + memset(&temp_phy, 0, sizeof(temp_phy));
> + memset(&temp_priv, 0, sizeof(temp_priv));
> + memset(&temp_mii, 0, sizeof(temp_mii));
struct mii_dev temp_mii = { 0 }; etc
should work all the same, no need for memset.
More information about the U-Boot
mailing list