wlan: Initialize the local variables correctly

Currently, In the nl_srv_ucast & nl_srv_bcast functions, the local
return variable is not initialized.So if there is any failure in
sending the nl broadcast or unicast request  the  local return
variable is updated with error code, but if the global socket
structure is NULL garbage value will be returned.

Hence intialize the local return variable with the -EINVAL.

Change-Id: I89c34d43d985dee429f2a67f2942142c12a93482
CRs-Fixed: 1040564
diff --git a/CORE/SVC/src/nlink/wlan_nlink_srv.c b/CORE/SVC/src/nlink/wlan_nlink_srv.c
index d3c84d8..facf905 100644
--- a/CORE/SVC/src/nlink/wlan_nlink_srv.c
+++ b/CORE/SVC/src/nlink/wlan_nlink_srv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -164,7 +164,7 @@
  */
 int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
 {
-   int err;
+   int err = -EINVAL;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
    NETLINK_CB(skb).pid = 0; //sender's pid
@@ -175,14 +175,13 @@
    if (nl_srv_sock != NULL) {
       err = netlink_unicast(nl_srv_sock, skb,
                             dst_pid, flag);
+      if (err < 0)
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: netlink_unicast to pid[%d] failed, ret[%d]", dst_pid, err);
    }
    else
       dev_kfree_skb(skb);
 
-   if (err < 0)
-      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-      "NLINK: netlink_unicast to pid[%d] failed, ret[%d]", dst_pid, err);
-
    return err;
 }
 
@@ -192,7 +191,7 @@
  */
 int nl_srv_bcast(struct sk_buff *skb)
 {
-   int err;
+   int err = -EINVAL;
    int flags = GFP_KERNEL;
 
    if (in_interrupt() || irqs_disabled() || in_atomic())
@@ -204,19 +203,18 @@
    NETLINK_CB(skb).portid = 0; //sender's pid
 #endif
    NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID; //destination group
-   if (nl_srv_sock != NULL){
+   if (nl_srv_sock != NULL) {
       err = netlink_broadcast(nl_srv_sock, skb, 0,
                               WLAN_NLINK_MCAST_GRP_ID, flags);
+
+      if ((err < 0) && (err != -ESRCH))
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+         "NLINK: netlink_broadcast failed err = %d", err);
    }
    else
       dev_kfree_skb(skb);
 
 
-   if ((err < 0) && (err != -ESRCH))
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-         "NLINK: netlink_broadcast failed err = %d", err);
-   }
    return err;
 }