pcm_file: improve error checking in write_wav_header function
previously errno would be returned even for cases where it may have
not been populated, for example one of the write functions failing,
or writing only partial buffer,
now progress through write operations separately and report errno when
appropriate
Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com> Reviewed-by: Timo Wischer <twischer@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>