summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2019-02-26 11:48:11 -0500
committerTom St Denis <tom.stdenis@amd.com>2019-02-26 11:48:11 -0500
commit684f938ac47082d7543e5863bed92c4f7ff5c6e4 (patch)
tree52e52455d78757f93266e9c3ed0ba476fc06a27f
parent1f7f7395cccabef9fd342de7600dc61296eec2b0 (diff)
fix various bugs that fell out of refactoring the shader code
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
-rw-r--r--src/lib/shader_disasm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/shader_disasm.c b/src/lib/shader_disasm.c
index d703e81..2c91402 100644
--- a/src/lib/shader_disasm.c
+++ b/src/lib/shader_disasm.c
@@ -58,14 +58,14 @@ static struct umr_wave_data *find_wave(struct umr_wave_data *wd, unsigned vmid,
int umr_vm_disasm_to_str(struct umr_asic *asic, unsigned vmid, uint64_t addr, uint64_t PC, uint32_t size, uint32_t start_offset, char ***out)
{
uint32_t *opcodes = NULL, x, y;
- char **opcode_strs;
+ char **opcode_strs = NULL;
int r = 0;
char linebuf[512];
opcodes = calloc(size/4, sizeof(*opcodes));
- *out = calloc(size/4 + 1, sizeof(*out));
+ *out = calloc(size/4 + 1, sizeof(**out));
- if (!*out || !opcode_strs || !opcodes) {
+ if (!*out || !opcodes) {
fprintf(stderr, "[ERROR]: Out of memory\n");
r = -1;
goto error;
@@ -73,8 +73,10 @@ int umr_vm_disasm_to_str(struct umr_asic *asic, unsigned vmid, uint64_t addr, ui
// read the shader from an offset. This allows us to know
// where the shader starts but only read/display a portion of it
- if (umr_read_vram(asic, vmid, addr + start_offset, size, (void*)opcodes))
+ if (umr_read_vram(asic, vmid, addr + start_offset, size, (void*)opcodes)) {
+ r = -1;
goto error;
+ }
umr_shader_disasm(asic, (uint8_t *)opcodes, size, addr + start_offset, &opcode_strs);
@@ -111,7 +113,7 @@ error:
*/
int umr_vm_disasm(struct umr_asic *asic, unsigned vmid, uint64_t addr, uint64_t PC, uint32_t size, uint32_t start_offset, struct umr_wave_data *wd)
{
- uint32_t *opcodes = NULL, x, y, nwave, wavehits;
+ uint32_t x, y, nwave, wavehits;
struct umr_wave_data *pwd;
int r = 0;
char **outstrs;