diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index 655dc9abc6adc3341256b793d18e9c6800ab8879..fe287c07a7726d79edc99325157e50281b7fde3a 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -1666,9 +1666,8 @@ static void _slurm_rpc_ping(slurm_msg_t * msg)
 {
 	/* init */
 	int error_code = SLURM_SUCCESS;
-	uid_t uid;
+	uid_t uid = slurm_auth_uid(msg->cred);
 
-	uid = slurm_auth_uid(msg->cred);
 	if ((uid != 0) && (uid != getuid())) {
 		error("Security violation, PING RPC from uid %u",
 		      (unsigned int) uid);