astlpc: Fix version test before assignment
The bug leads to the wrong packet size being used for the first
negotiation.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I1419c5905b28153594304d8fb5511c5c4782fe72
diff --git a/astlpc.c b/astlpc.c
index 64dd9de..75318eb 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -681,7 +681,8 @@
return MCTP_BODY_SIZE(ASTLPC_BODY_SIZE(MIN(limit, layout->tx.size)));
}
-static int mctp_astlpc_negotiate_layout_bmc(struct mctp_binding_astlpc *astlpc)
+static int mctp_astlpc_negotiate_layout_bmc(struct mctp_binding_astlpc *astlpc,
+ uint16_t version)
{
struct mctp_astlpc_layout proposed, pending;
uint32_t sz, mtu;
@@ -723,7 +724,7 @@
return -EINVAL;
}
- if (astlpc->version >= 2)
+ if (version >= 2)
astlpc->binding.pkt_size = MCTP_PACKET_SIZE(mtu);
return 0;
@@ -745,7 +746,7 @@
be16toh(hdr.host_ver_cur));
/* Host Rx MTU negotiation: Failure terminates channel init */
- rc = mctp_astlpc_negotiate_layout_bmc(astlpc);
+ rc = mctp_astlpc_negotiate_layout_bmc(astlpc, negotiated);
if (rc < 0)
negotiated = ASTLPC_VER_BAD;