linux_spi: Use fgets() to read buffer size

Since fread() returns the number of bytes read, this currently will only
check for errors if it returns 0 (i.e. the file was empty). However, it
is possible for fread() to encounter an error after reading a few bytes,
which this doesn't catch. Fix this by using fgets() instead, which will
return NULL if EOF or an error is encountered, and is simpler anyway.

Change-Id: I4f37c70e97149b87c6344e63a57d11ddde7638c4
Signed-off-by: Jacob Garber <>
Found-by: Coverity CID 1403824
Tested-by: build bot (Jenkins) <>
Reviewed-by: David Hendricks <>
1 file changed