diff mbox series

[1/1] net: ethernet: stmmac: fix warning when w=1 option is used during build

Message ID 20191104083438.8288-1-christophe.roullier@st.com (mailing list archive)
State Mainlined
Commit 54e0602d796ceb20b292e9d364046b6b2724f735
Headers show
Series [1/1] net: ethernet: stmmac: fix warning when w=1 option is used during build | expand

Commit Message

Christophe Roullier Nov. 4, 2019, 8:34 a.m. UTC
This patch fix the following warning:

warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  int val, ret;

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Marc Gonzalez Nov. 4, 2019, 8:57 a.m. UTC | #1
On 04/11/2019 09:34, Christophe Roullier wrote:

> This patch fix the following warning:
> 
> warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>   int val, ret;

FWIW, I believe the commit summary (i.e. the subject) should be as specific
as possible in the few characters allowed. In particular, it should mention
/what/ was changed.

Then the commit message would provide more information about /why/ it was
changed, and perhaps how it came to be discovered.

For example:

net: ethernet: stmmac: drop unused variable in stm32mp1_set_mode()

Building with W=1 (cf. scripts/Makefile.extrawarn) outputs:
warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Drop the unused 'ret' variable.


>  drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> index 4ef041bdf6a1..595af2ec89fb 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> @@ -175,7 +175,7 @@ static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat)
>  {
>  	struct stm32_dwmac *dwmac = plat_dat->bsp_priv;
>  	u32 reg = dwmac->mode_reg;
> -	int val, ret;
> +	int val;
>  
>  	switch (plat_dat->interface) {
>  	case PHY_INTERFACE_MODE_MII:
> @@ -211,8 +211,8 @@ static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat)
>  	}
>  
>  	/* Need to update PMCCLRR (clear register) */
> -	ret = regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET,
> -			   dwmac->ops->syscfg_eth_mask);
> +	regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET,
> +		     dwmac->ops->syscfg_eth_mask);
>  
>  	/* Update PMCSETR (set register) */
>  	return regmap_update_bits(dwmac->regmap, reg,
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index 4ef041bdf6a1..595af2ec89fb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -175,7 +175,7 @@  static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat)
 {
 	struct stm32_dwmac *dwmac = plat_dat->bsp_priv;
 	u32 reg = dwmac->mode_reg;
-	int val, ret;
+	int val;
 
 	switch (plat_dat->interface) {
 	case PHY_INTERFACE_MODE_MII:
@@ -211,8 +211,8 @@  static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat)
 	}
 
 	/* Need to update PMCCLRR (clear register) */
-	ret = regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET,
-			   dwmac->ops->syscfg_eth_mask);
+	regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET,
+		     dwmac->ops->syscfg_eth_mask);
 
 	/* Update PMCSETR (set register) */
 	return regmap_update_bits(dwmac->regmap, reg,