lkml.org 
[lkml]   [2006]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] sound: fix hang in mpu401_uart.c
    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
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-04-18 15:20    [W:3.163 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site