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

Commit 16557f1e authored by Christian König's avatar Christian König Committed by Dave Airlie
Browse files

drm/radeon: no need to check all relocs for duplicates



Only check the previously checked relocs for
duplicates. Also leaving the handle uninitialized
isn't such a good idea.

Signed-off-by: default avatarChristian König <deathsimple@vodafone.de>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 4d8bf9ae
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)


		duplicate = false;
		duplicate = false;
		r = (struct drm_radeon_cs_reloc *)&chunk->kdata[i*4];
		r = (struct drm_radeon_cs_reloc *)&chunk->kdata[i*4];
		for (j = 0; j < p->nrelocs; j++) {
		for (j = 0; j < i; j++) {
			if (r->handle == p->relocs[j].handle) {
			if (r->handle == p->relocs[j].handle) {
				p->relocs_ptr[i] = &p->relocs[j];
				p->relocs_ptr[i] = &p->relocs[j];
				duplicate = true;
				duplicate = true;
@@ -84,7 +84,8 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
			p->relocs[i].flags = r->flags;
			p->relocs[i].flags = r->flags;
			radeon_bo_list_add_object(&p->relocs[i].lobj,
			radeon_bo_list_add_object(&p->relocs[i].lobj,
						  &p->validated);
						  &p->validated);
		}
		} else
			p->relocs[i].handle = 0;
	}
	}
	return radeon_bo_list_validate(&p->validated);
	return radeon_bo_list_validate(&p->validated);
}
}