intel/tools: make sure the binary file is properly read
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Wed, 14 Nov 2018 16:30:48 +0000 (18:30 +0200)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 4 Dec 2018 16:19:26 +0000 (16:19 +0000)
commit6ae873b97d3b6be8855b70ae13fb31d95e948fcc
tree224ef060fe0fffd16e1eabc53072a2a5733e89a0
parentd7b99ab94728980aa88de78b427d2eca7eb39a27
intel/tools: make sure the binary file is properly read

1. tools/i965_disasm.c:58:4: warning:
     ignoring return value of ‘fread’,
     declared with attribute warn_unused_result
     fread(assembly, *end, 1, fp);

v2: Fixed incorrect return value check.
       ( Eric Engestrom <eric.engestrom@intel.com> )

v3: Zero size file check placed before fread with exit()
       ( Eric Engestrom <eric.engestrom@intel.com> )

v4: - Title is changed.
    - The 'size' variable was moved to top of a function scope.
    - The assertion was replaced by the proper error handling.
    - The error message on a caller side was fixed.
       ( Eric Engestrom <eric.engestrom@intel.com> )

Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/intel/tools/i965_disasm.c