diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
index 7033c0f61163452d987aed5729c9b0707365842f..74b8de71922716b275a9628f41158290ed3cefa8 100644
--- a/sound/oss/ymfpci.c
+++ b/sound/oss/ymfpci.c
@@ -2628,7 +2628,8 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
  out_release_region:
 	release_mem_region(pci_resource_start(pcidev, 0), 0x8000);
  out_free:
-	ac97_release_codec(codec->ac97_codec[0]);
+	if (codec->ac97_codec[0])
+		ac97_release_codec(codec->ac97_codec[0]);
 	return -ENODEV;
 }