diff mbox series

net: fec: Silence M5272 build warnings

Message ID 20210202130650.865023-1-geert@linux-m68k.org (mailing list archive)
State Accepted
Commit 32d1bbb1d609f5a78b0c95e2189f398a52a3fbf7
Delegated to: Netdev Maintainers
Headers show
Series net: fec: Silence M5272 build warnings | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 84 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Geert Uytterhoeven Feb. 2, 2021, 1:06 p.m. UTC
If CONFIG_M5272=y:

    drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_restart’:
    drivers/net/ethernet/freescale/fec_main.c:948:6: warning: unused variable ‘val’ [-Wunused-variable]
      948 |  u32 val;
	  |      ^~~
    drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_get_mac’:
    drivers/net/ethernet/freescale/fec_main.c:1667:28: warning: unused variable ‘pdata’ [-Wunused-variable]
     1667 |  struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
	  |                            ^~~~~

Fix this by moving the variable declarations inside the existing #ifdef
blocks.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/ethernet/freescale/fec_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Guenter Roeck Feb. 2, 2021, 4:27 p.m. UTC | #1
On Tue, Feb 02, 2021 at 02:06:50PM +0100, Geert Uytterhoeven wrote:
> If CONFIG_M5272=y:
> 
>     drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_restart’:
>     drivers/net/ethernet/freescale/fec_main.c:948:6: warning: unused variable ‘val’ [-Wunused-variable]
>       948 |  u32 val;
> 	  |      ^~~
>     drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_get_mac’:
>     drivers/net/ethernet/freescale/fec_main.c:1667:28: warning: unused variable ‘pdata’ [-Wunused-variable]
>      1667 |  struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
> 	  |                            ^~~~~
> 
> Fix this by moving the variable declarations inside the existing #ifdef
> blocks.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/net/ethernet/freescale/fec_main.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 9ebdb0e54291b204..3db882322b2bd3e8 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -945,7 +945,6 @@ static void
>  fec_restart(struct net_device *ndev)
>  {
>  	struct fec_enet_private *fep = netdev_priv(ndev);
> -	u32 val;
>  	u32 temp_mac[2];
>  	u32 rcntl = OPT_FRAME_SIZE | 0x04;
>  	u32 ecntl = 0x2; /* ETHEREN */
> @@ -997,7 +996,8 @@ fec_restart(struct net_device *ndev)
>  
>  #if !defined(CONFIG_M5272)
>  	if (fep->quirks & FEC_QUIRK_HAS_RACC) {
> -		val = readl(fep->hwp + FEC_RACC);
> +		u32 val = readl(fep->hwp + FEC_RACC);
> +
>  		/* align IP header */
>  		val |= FEC_RACC_SHIFT16;
>  		if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
> @@ -1664,7 +1664,6 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
>  static void fec_get_mac(struct net_device *ndev)
>  {
>  	struct fec_enet_private *fep = netdev_priv(ndev);
> -	struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
>  	unsigned char *iap, tmpaddr[ETH_ALEN];
>  
>  	/*
> @@ -1695,6 +1694,8 @@ static void fec_get_mac(struct net_device *ndev)
>  		if (FEC_FLASHMAC)
>  			iap = (unsigned char *)FEC_FLASHMAC;
>  #else
> +		struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
> +
>  		if (pdata)
>  			iap = (unsigned char *)&pdata->mac;
>  #endif
> -- 
> 2.25.1
>
patchwork-bot+netdevbpf@kernel.org Feb. 3, 2021, 3:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue,  2 Feb 2021 14:06:50 +0100 you wrote:
> If CONFIG_M5272=y:
> 
>     drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_restart’:
>     drivers/net/ethernet/freescale/fec_main.c:948:6: warning: unused variable ‘val’ [-Wunused-variable]
>       948 |  u32 val;
> 	  |      ^~~
>     drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_get_mac’:
>     drivers/net/ethernet/freescale/fec_main.c:1667:28: warning: unused variable ‘pdata’ [-Wunused-variable]
>      1667 |  struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
> 	  |                            ^~~~~
> 
> [...]

Here is the summary with links:
  - net: fec: Silence M5272 build warnings
    https://git.kernel.org/netdev/net-next/c/32d1bbb1d609

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

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 9ebdb0e54291b204..3db882322b2bd3e8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -945,7 +945,6 @@  static void
 fec_restart(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
-	u32 val;
 	u32 temp_mac[2];
 	u32 rcntl = OPT_FRAME_SIZE | 0x04;
 	u32 ecntl = 0x2; /* ETHEREN */
@@ -997,7 +996,8 @@  fec_restart(struct net_device *ndev)
 
 #if !defined(CONFIG_M5272)
 	if (fep->quirks & FEC_QUIRK_HAS_RACC) {
-		val = readl(fep->hwp + FEC_RACC);
+		u32 val = readl(fep->hwp + FEC_RACC);
+
 		/* align IP header */
 		val |= FEC_RACC_SHIFT16;
 		if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
@@ -1664,7 +1664,6 @@  static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
 static void fec_get_mac(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
-	struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
 	unsigned char *iap, tmpaddr[ETH_ALEN];
 
 	/*
@@ -1695,6 +1694,8 @@  static void fec_get_mac(struct net_device *ndev)
 		if (FEC_FLASHMAC)
 			iap = (unsigned char *)FEC_FLASHMAC;
 #else
+		struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
+
 		if (pdata)
 			iap = (unsigned char *)&pdata->mac;
 #endif