fix(versal): modify function to have single return

This corrects the MISRA violation C2012-15.5:
A function should have a single point of exit at the end.
Introduced a temporary variable to store the return value to
ensure single return for the function.

Change-Id: Iffbd8770fd4ff2f2176062469d22961cbaa160b4
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
diff --git a/plat/xilinx/versal/plat_versal.c b/plat/xilinx/versal/plat_versal.c
index ba17b1d..6e0b2d6 100644
--- a/plat/xilinx/versal/plat_versal.c
+++ b/plat/xilinx/versal/plat_versal.c
@@ -10,13 +10,12 @@
 
 int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
 {
-	if ((mpidr & MPIDR_CLUSTER_MASK) != 0U) {
-		return -1;
+	int32_t ret = -1;
+
+	if (((mpidr & MPIDR_CLUSTER_MASK) == 0U) &&
+	       ((mpidr & MPIDR_CPU_MASK) < PLATFORM_CORE_COUNT)) {
+		ret = versal_calc_core_pos(mpidr);
 	}
 
-	if ((mpidr & MPIDR_CPU_MASK) >= PLATFORM_CORE_COUNT) {
-		return -1;
-	}
-
-	return (int32_t)versal_calc_core_pos(mpidr);
+	return ret;
 }