Patchwork [U-Boot] board/esd/cpci750/mv_eth.c: Fix GCC 4.6 build warnings

login
register
mail settings
Submitter Anatolij Gustschin
Date Dec. 20, 2011, 3:16 p.m.
Message ID <1324394205-30000-1-git-send-email-agust@denx.de>
Download mbox | patch
Permalink /patch/132437/
State Accepted
Headers show

Comments

Anatolij Gustschin - Dec. 20, 2011, 3:16 p.m.
Fix:
mv_eth.c: In function 'mv64360_eth_real_open':
mv_eth.c:425:6: warning: variable 'port_status' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_stop':
mv_eth.c:643:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_xmit':
mv_eth.c:719:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_receive':
mv_eth.c:804:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_get_stats':
mv_eth.c:903:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_update_stat':
mv_eth.c:931:24: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
mv_eth.c:930:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'mv64360_eth_print_stat':
mv_eth.c:1012:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
mv_eth.c: In function 'eth_clear_mib_counters':
mv_eth.c:2069:15: warning: variable 'dummy' set but not used [-Wunused-but-set-variable

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Reinhard Arlt <reinhard.arlt@esd.eu>
---
 board/esd/cpci750/mv_eth.c |   34 +++++++---------------------------
 1 files changed, 7 insertions(+), 27 deletions(-)
Wolfgang Denk - Dec. 20, 2011, 10:20 p.m.
Dear Anatolij Gustschin,

In message <1324394205-30000-1-git-send-email-agust@denx.de> you wrote:
> Fix:
> mv_eth.c: In function 'mv64360_eth_real_open':
> mv_eth.c:425:6: warning: variable 'port_status' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_stop':
> mv_eth.c:643:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_xmit':
> mv_eth.c:719:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_receive':
> mv_eth.c:804:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_get_stats':
> mv_eth.c:903:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_update_stat':
> mv_eth.c:931:24: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
> mv_eth.c:930:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'mv64360_eth_print_stat':
> mv_eth.c:1012:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable]
> mv_eth.c: In function 'eth_clear_mib_counters':
> mv_eth.c:2069:15: warning: variable 'dummy' set but not used [-Wunused-but-set-variable
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Reinhard Arlt <reinhard.arlt@esd.eu>
> ---
>  board/esd/cpci750/mv_eth.c |   34 +++++++---------------------------
>  1 files changed, 7 insertions(+), 27 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c
index 781ad23..001c1ad 100644
--- a/board/esd/cpci750/mv_eth.c
+++ b/board/esd/cpci750/mv_eth.c
@@ -422,7 +422,7 @@  static int mv64360_eth_real_open (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	unsigned int port_num;
-	u32 port_status, phy_reg_data;
+	u32 phy_reg_data;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	/* ronen - when we update the MAC env params we only update dev->enetaddr
@@ -520,7 +520,7 @@  static int mv64360_eth_real_open (struct eth_device *dev)
 	 */
 
 	MV_REG_WRITE (MV64360_ETH_MAXIMUM_TRANSMIT_UNIT (port_num), 0);
-	port_status = MV_REG_READ (MV64360_ETH_PORT_STATUS_REG (port_num));
+	MV_REG_READ (MV64360_ETH_PORT_STATUS_REG (port_num));
 
 	/* Check Link status on phy */
 	eth_port_read_smi_reg (port_num, 1, &phy_reg_data);
@@ -638,15 +638,6 @@  static int mv64360_eth_free_rx_rings (struct eth_device *dev)
 
 int mv64360_eth_stop (struct eth_device *dev)
 {
-	ETH_PORT_INFO *ethernet_private;
-	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
-
-	ethernet_private = (ETH_PORT_INFO *) dev->priv;
-	port_private =
-		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
-
 	/* Disable all gigE address decoder */
 	MV_REG_WRITE (MV64360_ETH_BASE_ADDR_ENABLE_REG, 0x3f);
 	DP (printf ("%s Ethernet stop called ... \n", __FUNCTION__));
@@ -716,7 +707,6 @@  int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr,
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 	PKT_INFO pkt_info;
 	ETH_FUNC_RET_STATUS status;
 	struct net_device_stats *stats;
@@ -725,7 +715,6 @@  int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr,
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 
 	stats = port_private->stats;
 
@@ -801,7 +790,6 @@  int mv64360_eth_receive (struct eth_device *dev)
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 	PKT_INFO pkt_info;
 	struct net_device_stats *stats;
 
@@ -809,7 +797,6 @@  int mv64360_eth_receive (struct eth_device *dev)
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	while ((eth_port_receive (ethernet_private, ETH_Q0, &pkt_info) ==
@@ -900,12 +887,10 @@  static struct net_device_stats *mv64360_eth_get_stats (struct eth_device *dev)
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 
 	mv64360_eth_update_stat (dev);
 
@@ -927,13 +912,10 @@  static void mv64360_eth_update_stat (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	struct net_device_stats *stats;
-	unsigned int port_num;
-	volatile unsigned int dummy;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	/* These are false updates */
@@ -956,12 +938,12 @@  static void mv64360_eth_update_stat (struct eth_device *dev)
 	 * But the unsigned long in PowerPC and MIPS are 32bit. So the next read
 	 * is just a dummy read for proper work of the GigE port
 	 */
-	dummy = eth_read_mib_counter (ethernet_private->port_num,
+	(void)eth_read_mib_counter (ethernet_private->port_num,
 				      ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH);
 	stats->tx_bytes += (unsigned long)
 		eth_read_mib_counter (ethernet_private->port_num,
 				      ETH_MIB_GOOD_OCTETS_SENT_LOW);
-	dummy = eth_read_mib_counter (ethernet_private->port_num,
+	(void)eth_read_mib_counter (ethernet_private->port_num,
 				      ETH_MIB_GOOD_OCTETS_SENT_HIGH);
 	stats->rx_errors += (unsigned long)
 		eth_read_mib_counter (ethernet_private->port_num,
@@ -1009,12 +991,10 @@  static void mv64360_eth_print_stat (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	struct net_device_stats *stats;
-	unsigned int port_num;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	/* These are false updates */
@@ -2066,13 +2046,13 @@  static void eth_port_init_mac_tables (ETH_PORT eth_port_num)
 static void eth_clear_mib_counters (ETH_PORT eth_port_num)
 {
 	int i;
-	unsigned int dummy;
 
 	/* Perform dummy reads from MIB counters */
 	for (i = ETH_MIB_GOOD_OCTETS_RECEIVED_LOW; i < ETH_MIB_LATE_COLLISION;
-	     i += 4)
-		dummy = MV_REG_READ ((MV64360_ETH_MIB_COUNTERS_BASE
+	     i += 4) {
+		(void)MV_REG_READ ((MV64360_ETH_MIB_COUNTERS_BASE
 				      (eth_port_num) + i));
+	}
 
 	return;
 }