ALSA: pcsp: Fix the order of input device unregistration
authorTakashi Iwai <tiwai@suse.de>
Thu, 14 Nov 2013 14:45:12 +0000 (15:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2014 13:44:31 +0000 (06:44 -0700)
commit 6408eac2665955343cd0e4bcd7d6237ce39611ed upstream.

The current code may access to the already freed object.  The input
device must be accessed and unregistered before freeing the top level
sound object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/drivers/pcsp/pcsp.c

index 99704e6..7ab6741 100644 (file)
@@ -187,8 +187,8 @@ static int __devinit pcsp_probe(struct platform_device *dev)
 static int __devexit pcsp_remove(struct platform_device *dev)
 {
        struct snd_pcsp *chip = platform_get_drvdata(dev);
-       alsa_card_pcsp_exit(chip);
        pcspkr_input_remove(chip->input_dev);
+       alsa_card_pcsp_exit(chip);
        platform_set_drvdata(dev, NULL);
        return 0;
 }