ALSA: atmel/ac97c: correct the unexpected behavior when using uninitial value for...
authorBo Shen <voice.shen@atmel.com>
Fri, 11 May 2012 09:39:28 +0000 (17:39 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 May 2012 10:10:04 +0000 (12:10 +0200)
When pdata->reset_pin is passed with a negative value (means gpio
is invalid), then chip->reset_pin will not be assigned to a vaule,
it will use default value 0. This will cause unexpected behavior.

So, add this patch to correct.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/atmel/ac97c.c

index 115313ef54d67e7d10cc6b6d4295a53bf49e340d..f5ded640b395312934396237299ac532ef2cb148 100644 (file)
@@ -991,6 +991,8 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
                        gpio_direction_output(pdata->reset_pin, 1);
                        chip->reset_pin = pdata->reset_pin;
                }
+       } else {
+               chip->reset_pin = -EINVAL;
        }
 
        snd_card_set_dev(card, &pdev->dev);