ALSA: hda: dynamic jack id
authorMatthew Ranostay <mranostay@embeddedalley.com>
Sat, 25 Oct 2008 05:05:29 +0000 (01:05 -0400)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Oct 2008 07:15:14 +0000 (08:15 +0100)
This patch duplicates the jack->id pointer with kstrdup() to prevent
scoping issues from calling autoprobing functions from the HDA section.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/jack.c

index c4bb9bad31331b0e4536a913fc7a67bdd0b3aaf8..438445f77d6d8dd68eb3d4fd9ca846f2b3a6dc30 100644 (file)
@@ -34,6 +34,7 @@ static int snd_jack_dev_free(struct snd_device *device)
        else
                input_free_device(jack->input_dev);
 
+       kfree(jack->id);
        kfree(jack);
 
        return 0;
@@ -87,7 +88,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
        if (jack == NULL)
                return -ENOMEM;
 
-       jack->id = id;
+       jack->id = kstrdup(id, GFP_KERNEL);
 
        jack->input_dev = input_allocate_device();
        if (jack->input_dev == NULL) {