gprs_ns2: unify the handling of **result when bind already present.

All bind function should work in the same way.
Also fixing a null pointer assignment if no **result is giving.

Change-Id: Idd0c2190d2af39804c18c4786a997079db9a4330
diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index 88ef037..853375d 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -529,8 +529,8 @@
  *  \param[in] nsi NS instance in which to create the bind
  *  \param[in] local local address on which to bind
  *  \param[in] dscp DSCP/TOS bits to use for transmitted data on this bind
- *  \param[out] result pointer to created bind
- *  \return 0 on success; negative on error */
+ *  \param[out] result pointer to the created bind or if a bind with the name exists return the bind.
+ *  \return 0 on success; negative on error. -EALREADY returned in case a bind with the name exists */
 int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
 			const char *name,
 			const struct osmo_sockaddr *local,
@@ -546,7 +546,8 @@
 
 	bind = gprs_ns2_bind_by_name(nsi, name);
 	if (bind) {
-		*result = bind;
+		if (result)
+			*result = bind;
 		return -EALREADY;
 	}