Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88942b1e authored by Ashok Vuyyuru's avatar Ashok Vuyyuru Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa4: Compare unsigned value with less than zero always false



Because of wrong condition when it failed get cookie programming
GCI TRE with wrong coockie values. Add changes to correct if condition
logic with proper checks.

Change-Id: I19eb4a628c4d6ee7ad5ab6a98ba78ff8a58bf198
Signed-off-by: default avatarAshok Vuyyuru <avuyyuru@codeaurora.org>
parent 1cb8509a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3339,8 +3339,8 @@ int __gsi_get_gci_cookie(struct gsi_chan_ctx *ctx, uint16_t idx)
	 * idx is not completed yet and it is getting reused by a new TRE.
	 */
	ctx->stats.userdata_in_use++;
	for (i = 0; i < GSI_VEID_MAX; i++) {
	end = ctx->ring.max_num_elem + 1;
	for (i = 0; i < GSI_VEID_MAX; i++) {
		if (!ctx->user_data[end + i].valid) {
			ctx->user_data[end + i].valid = true;
			return end + i;
@@ -3349,7 +3349,7 @@ int __gsi_get_gci_cookie(struct gsi_chan_ctx *ctx, uint16_t idx)

	/* TODO: Increase escape buffer size if we hit this */
	GSIERR("user_data is full\n");
	return -EPERM;
	return 0xFFFF;
}

int __gsi_populate_gci_tre(struct gsi_chan_ctx *ctx,
@@ -3380,7 +3380,7 @@ int __gsi_populate_gci_tre(struct gsi_chan_ctx *ctx,
	gci_tre.buf_len = xfer->len;
	gci_tre.re_type = GSI_RE_COAL;
	gci_tre.cookie = __gsi_get_gci_cookie(ctx, idx);
	if (gci_tre.cookie < 0)
	if (gci_tre.cookie > (ctx->ring.max_num_elem + GSI_VEID_MAX))
		return -EPERM;

	/* write the TRE to ring */