Re: [PATCH] sound: fix hang in mpu401_uart.c

From: Jon Masters
Date: Tue Apr 18 2006 - 19:45:18 EST


On 4/18/06, Takashi Iwai <tiwai@xxxxxxx> wrote:

> > + if ((err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1))) {
> > + return -EFAULT;
>
> IMO, -EFAULT isn't a good choice for this kind of error.

What would you suggest?

> > 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?

I'll respin the patch later, but first, what should I return on open
when the underlying hardware is not there?

Jon.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/