From: Takashi Iwai <tiwai@suse.de>
To: Jon Masters <jonathan@jonmasters.org>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sound: fix hang in mpu401_uart.c
Date: Tue, 18 Apr 2006 15:18:01 +0200 [thread overview]
Message-ID: <s5hbquzxbsm.wl%tiwai@suse.de> (raw)
In-Reply-To: <20060416031235.GA6741@apogee.jonmasters.org>
At Sun, 16 Apr 2006 04:12:36 +0100,
Jon Masters wrote:
>
> From: Jon Masters <jcm@jonmasters.org>
>
> This fixes a hang in mpu401_uart.c that can occur when the mpu401
> interface is non-existent or otherwise doesn't respond to commands but
> we issue IO anyway. snd_mpu401_uart_cmd now returns an error code that is
> passed up the stack so that an open() will fail immediately in such cases.
>
> Eventually discovered after wine/cxoffice would constantly cause hard
> lockups on my desktop immediately after loading (emulating Windows too
> well). Turned out that I'd recently moved my sound cards around and
> using /dev/sequencer now talks to a sound card with a broken MPU.
>
> Signed-off-by: Jon Masters <jcm@jonmasters.org>
(snip)
> @@ -235,8 +238,12 @@
> if (mpu->open_input && (err = mpu->open_input(mpu)) < 0)
> return err;
> if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) {
> - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1);
> - snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1);
> + if ((err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1))) {
> + return -EFAULT;
IMO, -EFAULT isn't a good choice for this kind of error.
> @@ -252,8 +259,10 @@
> if (mpu->open_output && (err = mpu->open_output(mpu)) < 0)
> return err;
> if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) {
> - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1);
> - snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1);
> + if ((err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)))
> + return -EFAULT;
> + if ((err = snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)))
> + return -EFAULT;
Missing close in the error path?
Takashi
next prev parent reply other threads:[~2006-04-18 13:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-16 3:12 Jon Masters
2006-04-18 13:18 ` Takashi Iwai [this message]
2006-04-18 23:45 ` Jon Masters
2006-04-19 9:33 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hbquzxbsm.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=akpm@osdl.org \
--cc=jonathan@jonmasters.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®