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

Commit 03900d53 authored by Ashok Vuyyuru's avatar Ashok Vuyyuru
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 fc596f63
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3375,8 +3375,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;
@@ -3385,7 +3385,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,
@@ -3416,7 +3416,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 */