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

Commit ef5115f7 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Fix several possible problem spots in the dispatcher



Fix a few spots that the compiler warnings missed. Avoid
dereferencing a pointer that may have returned ERR_PTR() without
first checking to see that if it did return ERR_PTR() and correct
an egregious signed / unsigned mixup. Not sure why the compiler
didn't yell at me for that one.

Change-Id: Ic0dedbadf075b34e51a89ce625d2308c5171a58d
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent cb982424
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -189,10 +189,9 @@ static inline int adreno_dispatcher_requeue_cmdbatch(
		return -EINVAL;
	}

	prev = drawctxt->cmdqueue_head - 1;

	if (prev < 0)
		prev = ADRENO_CONTEXT_CMDQUEUE_SIZE - 1;
	prev = drawctxt->cmdqueue_head == 0 ?
		(ADRENO_CONTEXT_CMDQUEUE_SIZE - 1) :
		(drawctxt->cmdqueue_head - 1);

	/*
	 * The maximum queue size always needs to be one less then the size of
@@ -349,9 +348,6 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,

		cmdbatch = adreno_dispatcher_get_cmdbatch(drawctxt);

		if (cmdbatch == NULL)
			break;

		/*
		 * adreno_context_get_cmdbatch returns -EAGAIN if the current
		 * cmdbatch has pending sync points so no more to do here.
@@ -359,7 +355,8 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,
		 * reqeueued
		 */

		if (IS_ERR(cmdbatch) && PTR_ERR(cmdbatch) == -EAGAIN) {
		if (IS_ERR_OR_NULL(cmdbatch)) {
			if (IS_ERR(cmdbatch) && PTR_ERR(cmdbatch) == -EAGAIN)
				requeued = 1;
			break;
		}