snd_ich(4): Handle errors from ich_init() properly during resume.

ich_init() returns an errno value or 0, but ich_pci_resume() was
comparing the return value with -1 to determine whether an error had
occurred.

PR:		248941
Submitted by:	Tong Zhang <ztong0001@gmail.com>
MFC after:	1 week
This commit is contained in:
Mark Johnston 2020-08-27 16:36:07 +00:00
parent b3cb04b930
commit 555e998919

View File

@ -1190,16 +1190,17 @@ static int
ich_pci_resume(device_t dev)
{
struct sc_info *sc;
int i;
int err, i;
sc = pcm_getdevinfo(dev);
ICH_LOCK(sc);
/* Reinit audio device */
if (ich_init(sc) == -1) {
err = ich_init(sc);
if (err != 0) {
device_printf(dev, "unable to reinitialize the card\n");
ICH_UNLOCK(sc);
return (ENXIO);
return (err);
}
/* Reinit mixer */
ich_pci_codec_reset(sc);