diff options
author | Takashi Iwai <tiwai@alsa3.local> | 2008-12-28 10:47:30 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-12 09:21:54 -0500 |
commit | 3e7fb9f7ec00fd7cefd0d8e83df0cff86ce12515 (patch) | |
tree | dd04faa1ccf4d894bda0ca14eb667bc4be096623 /sound/isa/sb/sb16.c | |
parent | d453379bc5d34d7f55b55931245de5ac1896fd8d (diff) |
ALSA: Return proper error code at probe in sound/isa/*
Some drivers in sound/isa/* don't handle the error code properly
from snd_card_create(). This patch fixes these places.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/sb/sb16.c')
-rw-r--r-- | sound/isa/sb/sb16.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index adf4fdd2c4aa..519c36346dec 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -324,7 +324,7 @@ static void snd_sb16_free(struct snd_card *card) | |||
324 | #define is_isapnp_selected(dev) 0 | 324 | #define is_isapnp_selected(dev) 0 |
325 | #endif | 325 | #endif |
326 | 326 | ||
327 | static struct snd_card *snd_sb16_card_new(int dev) | 327 | static int snd_sb16_card_new(int dev, struct snd_card **cardp) |
328 | { | 328 | { |
329 | struct snd_card *card; | 329 | struct snd_card *card; |
330 | int err; | 330 | int err; |
@@ -332,9 +332,10 @@ static struct snd_card *snd_sb16_card_new(int dev) | |||
332 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 332 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
333 | sizeof(struct snd_card_sb16), &card); | 333 | sizeof(struct snd_card_sb16), &card); |
334 | if (err < 0) | 334 | if (err < 0) |
335 | return NULL; | 335 | return err; |
336 | card->private_free = snd_sb16_free; | 336 | card->private_free = snd_sb16_free; |
337 | return card; | 337 | *cardp = card; |
338 | return 0; | ||
338 | } | 339 | } |
339 | 340 | ||
340 | static int __devinit snd_sb16_probe(struct snd_card *card, int dev) | 341 | static int __devinit snd_sb16_probe(struct snd_card *card, int dev) |
@@ -492,9 +493,9 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev) | |||
492 | struct snd_card *card; | 493 | struct snd_card *card; |
493 | int err; | 494 | int err; |
494 | 495 | ||
495 | card = snd_sb16_card_new(dev); | 496 | err = snd_sb16_card_new(dev, &card); |
496 | if (! card) | 497 | if (err < 0) |
497 | return -ENOMEM; | 498 | return err; |
498 | 499 | ||
499 | acard = card->private_data; | 500 | acard = card->private_data; |
500 | /* non-PnP FM port address is hardwired with base port address */ | 501 | /* non-PnP FM port address is hardwired with base port address */ |
@@ -613,9 +614,9 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | |||
613 | for ( ; dev < SNDRV_CARDS; dev++) { | 614 | for ( ; dev < SNDRV_CARDS; dev++) { |
614 | if (!enable[dev] || !isapnp[dev]) | 615 | if (!enable[dev] || !isapnp[dev]) |
615 | continue; | 616 | continue; |
616 | card = snd_sb16_card_new(dev); | 617 | res = snd_sb16_card_new(dev, &card); |
617 | if (! card) | 618 | if (res < 0) |
618 | return -ENOMEM; | 619 | return res; |
619 | snd_card_set_dev(card, &pcard->card->dev); | 620 | snd_card_set_dev(card, &pcard->card->dev); |
620 | if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || | 621 | if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || |
621 | (res = snd_sb16_probe(card, dev)) < 0) { | 622 | (res = snd_sb16_probe(card, dev)) < 0) { |