ALSA: hda: fix kstrdup return value
authorHeloise NH <kernelpatch_update@163.com>
Fri, 17 Jul 2015 01:42:06 +0000 (09:42 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Jul 2015 12:56:19 +0000 (14:56 +0200)
In kstrdup we should return -ENOMEM when it reports an
memory allocation failure, while the -ENODEV is referred
to a failure in finding the cpu node in the device tree.

Signed-off-by: Heloise NH <kernelpatch_update@163.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index 5de3c5d8c2c0050c5c560c9aecfd0ab756932a59..d78fa713c103dd327ee007637c45034533f8b894 100644 (file)
@@ -975,7 +975,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
        if (codec->bus->modelname) {
                codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
                if (!codec->modelname) {
-                       err = -ENODEV;
+                       err = -ENOMEM;
                        goto error;
                }
        }