[rtems commit] sparc/.../grcan.c: Fix multiple warnings

Joel Sherrill joel at rtems.org
Sat Sep 21 21:19:52 UTC 2013


Module:    rtems
Branch:    master
Commit:    34b57d61be1416686f13b66cf0b687f1006fdc0d
Changeset: http://git.rtems.org/rtems/commit/?id=34b57d61be1416686f13b66cf0b687f1006fdc0d

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Sat Sep 21 16:10:17 2013 -0500

sparc/.../grcan.c: Fix multiple warnings

---

 c/src/lib/libbsp/sparc/shared/can/grcan.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/can/grcan.c b/c/src/lib/libbsp/sparc/shared/can/grcan.c
index d592fba..e7e0ca0 100644
--- a/c/src/lib/libbsp/sparc/shared/can/grcan.c
+++ b/c/src/lib/libbsp/sparc/shared/can/grcan.c
@@ -299,6 +299,12 @@ static void __inline__ grcan_hw_reset(struct grcan_regs *regs)
 	regs->ctrl = GRCAN_CTRL_RESET;
 }
 
+/*
+ * tmp is set but never used. GCC gives a warning for this
+ * and we need to tell GCC not to complain.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 static rtems_device_driver grcan_start(struct grcan_priv *pDev)
 {
   unsigned int tmp;
@@ -368,6 +374,7 @@ static rtems_device_driver grcan_start(struct grcan_priv *pDev)
    */
   return RTEMS_SUCCESSFUL;
 }
+#pragma GCC diagnostic pop
 
 static void grcan_stop(struct grcan_priv *pDev)
 {
@@ -533,7 +540,7 @@ static int grcan_calc_timing(
 {
 	int best_error = 1000000000;
 	int error;
-	int best_tseg=0, best_brp=0, best_rate=0, brp=0;
+	int best_tseg=0, best_brp=0, brp=0;
 	int tseg=0, tseg1=0, tseg2=0;
 	int sjw = 1;
 
@@ -583,7 +590,6 @@ static int grcan_calc_timing(
 			best_error = error;
 			best_tseg = tseg/2;
 			best_brp = brp-1;
-			best_rate = core_hz/(brp*(1+tseg/2));
 		}
 	}
 




More information about the vc mailing list