All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] sb16: request_region failure ignored in snd_sb16_isa_probe1()
Date: Mon, 21 Sep 2009 12:03:47 +0200	[thread overview]
Message-ID: <4AB74F83.4030606@gmail.com> (raw)

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
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;
 	}

             reply	other threads:[~2009-09-21  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 10:03 Roel Kluin [this message]
2009-09-21 10:33 ` [PATCH] sb16: request_region failure ignored in snd_sb16_isa_probe1() Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB74F83.4030606@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.