cifs: set resolved ip in sockaddr

All callers from dns_resolve_server_name_to_ip() used to convert the
ip addr string back to sockaddr, so do that inside
dns_resolve_server_name_to_ip() and avoid duplicating code.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
index 0b15d7e..ce21438 100644
--- a/fs/cifs/dfs.c
+++ b/fs/cifs/dfs.c
@@ -9,28 +9,6 @@
 #include "fs_context.h"
 #include "dfs.h"
 
-/* Resolve UNC server name and set destination ip address in fs context */
-static int resolve_unc(const char *path, struct smb3_fs_context *ctx)
-{
-	int rc;
-	char *ip = NULL;
-
-	rc = dns_resolve_server_name_to_ip(path, &ip, NULL);
-	if (rc < 0) {
-		cifs_dbg(FYI, "%s: failed to resolve UNC server name: %d\n", __func__, rc);
-		return rc;
-	}
-
-	if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip, strlen(ip))) {
-		cifs_dbg(VFS, "%s: could not determinate destination address\n", __func__);
-		rc = -EHOSTUNREACH;
-	} else
-		rc = 0;
-
-	kfree(ip);
-	return rc;
-}
-
 /**
  * dfs_parse_target_referral - set fs context for dfs target referral
  *
@@ -68,7 +46,7 @@ int dfs_parse_target_referral(const char *full_path, const struct dfs_info3_para
 	if (rc)
 		goto out;
 
-	rc = resolve_unc(path, ctx);
+	rc = dns_resolve_server_name_to_ip(path, (struct sockaddr *)&ctx->dstaddr, NULL);
 
 out:
 	kfree(path);