[GPRS] fix numerous compiler warnings
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 9fee9e1..35c850c 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -54,7 +54,7 @@
 #include <pdp.h>
 
 extern struct sgsn_instance *sgsn;
-extern struct ggsn_ctx *dummy_ggsn;
+extern struct sgsn_ggsn_ctx *dummy_ggsn;
 
 /* Protocol related stuff, should go into libosmocore */
 
@@ -201,7 +201,7 @@
 	struct msgb *msg = gsm48_msgb_alloc();
 	struct gsm48_hdr *gh;
 	struct gsm48_attach_ack *aa;
-	char *ptsig, *mid;
+	uint8_t *ptsig, *mid;
 
 	DEBUGP(DMM, "<- GPRS ATTACH ACCEPT\n");
 
@@ -268,7 +268,7 @@
 }
 
 /* Chapter 9.4.6.2 Detach accept */
-static gsm48_tx_gmm_det_ack(struct sgsn_mm_ctx *mm, uint8_t force_stby)
+static int gsm48_tx_gmm_det_ack(struct sgsn_mm_ctx *mm, uint8_t force_stby)
 {
 	struct msgb *msg = gsm48_msgb_alloc();
 	struct gsm48_hdr *gh;
@@ -326,7 +326,6 @@
 	struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
 	uint8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK;
 	char mi_string[GSM48_MI_SIZE];
-	struct gprs_ra_id ra_id;
 
 	gsm48_mi_to_string(mi_string, sizeof(mi_string), &gh->data[1], gh->data[0]);
 	DEBUGP(DMM, "-> GMM IDENTITY RESPONSE: mi_type=0x%02x MI(%s) ",
@@ -691,7 +690,6 @@
 int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp)
 {
 	struct msgb *msg = gsm48_msgb_alloc();
-	struct gsm48_act_pdp_ctx_ack *act_ack;
 	struct gsm48_hdr *gh;
 	uint8_t transaction_id = pdp->ti ^ 0x8; /* flip */
 
@@ -736,7 +734,6 @@
 			     uint8_t cause, uint8_t pco_len, uint8_t *pco_v)
 {
 	struct msgb *msg = gsm48_msgb_alloc();
-	struct gsm48_act_pdp_ctx_ack *act_ack;
 	struct gsm48_hdr *gh;
 	uint8_t transaction_id = tid ^ 0x8; /* flip */
 
@@ -761,7 +758,6 @@
 	struct msgb *msg = gsm48_msgb_alloc();
 	struct gsm48_hdr *gh;
 	uint8_t transaction_id = pdp->ti ^ 0x8; /* flip */
-	int rc;
 
 	DEBUGP(DMM, "<- DEACTIVATE PDP CONTEXT ACK\n");
 
@@ -780,7 +776,6 @@
 {
 	struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
 	struct gsm48_act_pdp_ctx_req *act_req = (struct gsm48_act_pdp_ctx_req *) gh->data;
-	uint8_t *pdp_addr_lv = act_req->data;
 	uint8_t req_qos_len, req_pdpa_len;
 	uint8_t *req_qos, *req_pdpa;
 	struct tlv_parsed tp;
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index 64786de..300a669 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -96,7 +96,7 @@
 {
 	struct sgsn_pdp_ctx *pctx;
 	struct pdp_t *pdp;
-	uint64_t imsi_ui64;
+	uint64_t imsi_ui64 = 0;
 	int rc;
 
 	LOGP(DGPRS, LOGL_ERROR, "Create PDP Context\n");
@@ -374,6 +374,9 @@
 	case 2:
 		rc = gtp_decaps1u(sgi->gsn);
 		break;
+	default:
+		rc = -EINVAL;
+		break;
 	}
 	return rc;
 }
@@ -395,7 +398,7 @@
 	timeval_normalize(b);
 
 	if (b->tv_sec > a->tv_sec ||
-	    b->tv_sec == a->tv_sec && b->tv_usec > a->tv_usec) {
+	    (b->tv_sec == a->tv_sec && b->tv_usec > a->tv_usec)) {
 		b->tv_sec = b->tv_usec = 0;
 		return -ERANGE;
 	}
@@ -413,7 +416,7 @@
 
 static void sgsn_gtp_tmr_start(struct sgsn_instance *sgi)
 {
-	struct timeval now, next, diff;
+	struct timeval now, next, diff = { 0, 0 };
 
 	/* Retrieve next retransmission as struct timeval */
 	gtp_retranstimeout(sgi->gsn, &next);
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index 4fe3e97..a065ba4 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -26,6 +26,7 @@
 
 #include <osmocore/talloc.h>
 #include <osmocore/utils.h>
+#include <osmocore/rate_ctr.h>
 
 #include <openbsc/debug.h>
 #include <openbsc/sgsn.h>
@@ -136,7 +137,6 @@
 {
 	uint32_t id = atoi(argv[0]);
 	struct sgsn_ggsn_ctx *ggc = sgsn_ggsn_ctx_find_alloc(id);
-	uint16_t port = atoi(argv[1]);
 
 	if (atoi(argv[1]))
 		ggc->gtp_version = 1;