slimbus: Fix the connect operation

Slimbus controller maintains port information associated with the Slimbus
master. When a channel is connected with a port, the port is assigned with
the channel properties. But the connect operation assigns the channel
properties even for a slave port.

Assign the channel properties only for the master port during the connect
operation.

CRs-Fixed: 2016162
Change-Id: Ic936b9d859b25da13ad63ce06a58b40838289909
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
diff --git a/drivers/slimbus/slimbus.c b/drivers/slimbus/slimbus.c
index aa7ff12..80b5874 100644
--- a/drivers/slimbus/slimbus.c
+++ b/drivers/slimbus/slimbus.c
@@ -1390,8 +1390,10 @@
 		txn.mc = SLIM_MSG_MC_CONNECT_SINK;
 	buf[0] = pn;
 	buf[1] = ctrl->chans[ch].chan;
-	if (la == SLIM_LA_MANAGER)
+	if (la == SLIM_LA_MANAGER) {
 		ctrl->ports[pn].flow = flow;
+		ctrl->ports[pn].ch = &ctrl->chans[ch].prop;
+	}
 	ret = slim_processtxn(ctrl, &txn, false);
 	if (!ret && la == SLIM_LA_MANAGER)
 		ctrl->ports[pn].state = SLIM_P_CFG;
@@ -1467,7 +1469,6 @@
 		ret = -EALREADY;
 		goto connect_src_err;
 	}
-	ctrl->ports[pn].ch = &slc->prop;
 	ret = connect_port_ch(ctrl, chan, srch, SLIM_SRC);
 
 	if (!ret)
@@ -1522,16 +1523,15 @@
 		u8 la = SLIM_HDL_TO_LA(sinkh[j]);
 		u8 pn = SLIM_HDL_TO_PORT(sinkh[j]);
 
-		if (la != SLIM_LA_MANAGER && flow != SLIM_SINK) {
+		if (la != SLIM_LA_MANAGER && flow != SLIM_SINK)
 			ret = -EINVAL;
-		} else if (la == SLIM_LA_MANAGER &&
+		else if (la == SLIM_LA_MANAGER &&
 			   (pn >= ctrl->nports ||
-			    ctrl->ports[pn].state != SLIM_P_UNCFG)) {
+			    ctrl->ports[pn].state != SLIM_P_UNCFG))
 			ret = -EINVAL;
-		} else {
-			ctrl->ports[pn].ch = &slc->prop;
+		else
 			ret = connect_port_ch(ctrl, chan, sinkh[j], SLIM_SINK);
-		}
+
 		if (ret) {
 			for (j = j - 1; j >= 0; j--)
 				disconnect_port_ch(ctrl, sinkh[j]);