[PATCH] sb16: request_region failure ignored in snd_sb16_isa_probe1()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



request_region() may fail. clean up if it does,
also a release region later on was missing.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
Found with sed: http://kernelnewbies.org/roelkluin

build, sparse and checkpatch tested.

diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 519c363..f50ed6f 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -502,6 +502,11 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
 	fm_port[dev] = port[dev];
 	/* block the 0x388 port to avoid PnP conflicts */
 	acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
+	if (acard->fm_res == NULL) {
+		snd_card_free(card);
+		return -ENOMEM;
+	}
+
 #ifdef SNDRV_SBAWE_EMU8000
 	/* non-PnP AWE port address is hardwired with base port address */
 	awe_port[dev] = port[dev] + 0x400;
@@ -509,6 +514,7 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
 
 	snd_card_set_dev(card, pdev);
 	if ((err = snd_sb16_probe(card, dev)) < 0) {
+		release_region(0x388, 4);
 		snd_card_free(card);
 		return err;
 	}
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux