mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 16:00:08 +01:00
pan/bi: use os_read_file-helper
We already have a more robust helper for this, so let's use it rather than open-coding the same. While we're at it, return early on error for readability here. There's no need to continue the logic in those cases. CID: 1444074 Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
This commit is contained in:
parent
046710ce95
commit
49183bfb79
1 changed files with 7 additions and 10 deletions
|
|
@ -31,6 +31,8 @@
|
|||
#include "valhall/disassemble.h"
|
||||
#include "panfrost/lib/pan_props.h"
|
||||
|
||||
#include "util/os_file.h"
|
||||
|
||||
unsigned gpu_id = 0x72120000;
|
||||
int verbose = 0;
|
||||
|
||||
|
|
@ -44,18 +46,13 @@ disassemble(const char *filename)
|
|||
FILE *fp = fopen(filename, "rb");
|
||||
assert(fp);
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
unsigned filesize = ftell(fp);
|
||||
rewind(fp);
|
||||
|
||||
uint32_t *code = malloc(filesize);
|
||||
unsigned res = fread(code, 1, filesize, fp);
|
||||
if (res != filesize) {
|
||||
printf("Couldn't read full file\n");
|
||||
size_t filesize = 0;
|
||||
uint32_t *code = (uint32_t *)os_read_file(filename, &filesize);
|
||||
if (!code) {
|
||||
fprintf(stderr, "Couldn't read full file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
void *entrypoint = code;
|
||||
|
||||
if (filesize && code[0] == BI_FOURCC('M', 'B', 'S', '2')) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue