netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581
@ 2025-04-15 10:53 Christian Marangi
  2025-04-15 11:03 ` AngeloGioacchino Del Regno
  2025-04-17  1:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Marangi @ 2025-04-15 10:53 UTC (permalink / raw)
  To: Daniel Golle, Qingfang Deng, SkyLake Huang, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno, Christian Marangi, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Simon Horman

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@kernel.org>
Fixes: 6a325aed130b ("net: phy: mediatek: add Airoha PHY ID to SoC driver")
Signed-off-by: Christian Marangi <ansuelsmth@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;
 
 	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;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581
  2025-04-15 10:53 [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581 Christian Marangi
@ 2025-04-15 11:03 ` AngeloGioacchino Del Regno
  2025-04-17  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-15 11:03 UTC (permalink / raw)
  To: Christian Marangi, Daniel Golle, Qingfang Deng, SkyLake Huang,
	Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	netdev, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Simon Horman

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@kernel.org>
> Fixes: 6a325aed130b ("net: phy: mediatek: add Airoha PHY ID to SoC driver")
> Signed-off-by: Christian Marangi <ansuelsmth@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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581
  2025-04-15 10:53 [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581 Christian Marangi
  2025-04-15 11:03 ` AngeloGioacchino Del Regno
@ 2025-04-17  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-17  1:40 UTC (permalink / raw)
  To: Christian Marangi
  Cc: daniel, dqfext, SkyLake.Huang, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
	netdev, linux-kernel, linux-arm-kernel, linux-mediatek, horms

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Apr 2025 12:53:05 +0200 you wrote:
> 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@kernel.org>
> Fixes: 6a325aed130b ("net: phy: mediatek: add Airoha PHY ID to SoC driver")
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581
    https://git.kernel.org/netdev/net-next/c/00868d034818

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-17  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 10:53 [net-next PATCH] net: phy: mediatek: init val in .phy_led_polarity_set for AN7581 Christian Marangi
2025-04-15 11:03 ` AngeloGioacchino Del Regno
2025-04-17  1:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).