net: altera-tse: Initialize local structs before using it
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Wed, 7 Jun 2023 13:59:37 +0000 (15:59 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 7 Jun 2023 20:30:11 +0000 (13:30 -0700)
The regmap_config and mdio_regmap_config objects needs to be zeroed before
using them. This will cause spurious errors at probe time as config->pad_bits
is containing random uninitialized data.

Fixes: db48abbaa18e ("net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/altera/altera_tse_main.c

index d866c0f..215f9fb 100644 (file)
@@ -1255,6 +1255,8 @@ static int altera_tse_probe(struct platform_device *pdev)
        if (ret)
                goto err_free_netdev;
 
+       memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
+       memset(&mrc, 0, sizeof(mrc));
        /* SGMII PCS address space. The location can vary depending on how the
         * IP is integrated. We can have a resource dedicated to it at a specific
         * address space, but if it's not the case, we fallback to the mdiophy0