[net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Tue Apr 15 04:03:53 PDT 2025
Il 15/04/25 12:53, Christian Marangi ha scritto:
> Fix smatch warning for uninitialised val in .phy_led_polarity_set for
> AN7581 driver.
>
> Correctly init to 0 to set polarity high by default.
>
> Reported-by: Simon Horman <horms at kernel.org>
> Fixes: 6a325aed130b ("net: phy: mediatek: add Airoha PHY ID to SoC driver")
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
> ---
> drivers/net/phy/mediatek/mtk-ge-soc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/mediatek/mtk-ge-soc.c b/drivers/net/phy/mediatek/mtk-ge-soc.c
> index fd0e447ffce7..cd09684780a4 100644
> --- a/drivers/net/phy/mediatek/mtk-ge-soc.c
> +++ b/drivers/net/phy/mediatek/mtk-ge-soc.c
> @@ -1432,8 +1432,8 @@ static int an7581_phy_probe(struct phy_device *phydev)
> static int an7581_phy_led_polarity_set(struct phy_device *phydev, int index,
> unsigned long modes)
> {
> + u16 val = 0;
> u32 mode;
> - u16 val;
....but that's double initialization then, so....
u32 mode;
u16 val;
if (index >= MTK_PHY_MAX_LEDS)
return -EINVAL;
if (modes == 0)
val = 0;
for_each_set_bit(.....
Cheers,
Angelo
>
> if (index >= MTK_PHY_MAX_LEDS)
> return -EINVAL;
> @@ -1444,7 +1444,6 @@ static int an7581_phy_led_polarity_set(struct phy_device *phydev, int index,
> val = MTK_PHY_LED_ON_POLARITY;
> break;
> case PHY_LED_ACTIVE_HIGH:
> - val = 0;
> break;
> default:
> return -EINVAL;
More information about the Linux-mediatek
mailing list