Browse Source

ALSA: lx646es: Fix possible uninitialized variable reference

lx_pipe_state() checks the return value from lx_message_send_atomic()
and breaks the loop only when it's a negative value.  However,
lx_message_send_atomic() may return a positive error code (as the
return code from the hardware), and then lx_pipe_state() tries to
compare the uninitialized current_state variable.

Fix this behavior by checking the positive non-zero error code as
well.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 9 years ago
parent
commit
a19c921fca
1 changed files with 1 additions and 1 deletions
  1. 1 1
      sound/pci/lx6464es/lx_core.c

+ 1 - 1
sound/pci/lx6464es/lx_core.c

@@ -644,7 +644,7 @@ static int lx_pipe_wait_for_state(struct lx6464es *chip, u32 pipe,
 		if (err < 0)
 		if (err < 0)
 			return err;
 			return err;
 
 
-		if (current_state == state)
+		if (!err && current_state == state)
 			return 0;
 			return 0;
 
 
 		mdelay(1);
 		mdelay(1);