ncsi: set a default callback if none is provided

If applyCmd is called once with a callback, and once without, the second
invocation will use the previous' function, which may no longer have
access to valid data.

Instead, unconditionally call nl_socket_modify_cb, but with
NL_CB_DEFAULT if no function was provided.

Change-Id: I16bc81888f381bf002379d4021e4e8aea28db15c
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
diff --git a/src/ncsi_util.cpp b/src/ncsi_util.cpp
index b71451e..c755d33 100644
--- a/src/ncsi_util.cpp
+++ b/src/ncsi_util.cpp
@@ -386,12 +386,9 @@
         nl_socket_disable_seq_check(socket.get());
     }
 
-    if (function)
-    {
-        // Add a callback function to the socket
-        nl_socket_modify_cb(socket.get(), NL_CB_VALID, NL_CB_CUSTOM, function,
-                            nullptr);
-    }
+    // Add a callback function to the socket
+    enum nl_cb_kind cb_kind = function ? NL_CB_CUSTOM : NL_CB_DEFAULT;
+    nl_socket_modify_cb(socket.get(), NL_CB_VALID, cb_kind, function, nullptr);
 
     ret = nl_send_auto(socket.get(), msg.get());
     if (ret < 0)