Browse Source

ALSA: hda: fix kstrdup return value

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>
Heloise NH 10 years ago
parent
commit
6986a0e255
1 changed files with 1 additions and 1 deletions
  1. 1 1
      sound/pci/hda/hda_codec.c

+ 1 - 1
sound/pci/hda/hda_codec.c

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