diff options
author | Rene Herman <rene.herman@keyaccess.nl> | 2006-04-11 08:09:37 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-04-12 05:55:32 -0400 |
commit | dcccdd938ef0c5d96145957217b814b14bd46cdc (patch) | |
tree | 8522ad7957ee85a7f0ab53f776afee8a05795be7 /sound/isa/adlib.c | |
parent | d0ac642d76c79c5cc673c4cdfe43e926379784e1 (diff) |
[ALSA] unregister platform device again if probe was unsuccessful
Unregister the platform device again if the probe was unsuccessful.
This restores the behaviour of not loading the driver on probe() failure.
Signed-off-by: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/adlib.c')
-rw-r--r-- | sound/isa/adlib.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index a253a14e6a45..1124344ed948 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c | |||
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device) | |||
43 | struct snd_card *card; | 43 | struct snd_card *card; |
44 | struct snd_opl3 *opl3; | 44 | struct snd_opl3 *opl3; |
45 | 45 | ||
46 | int error; | 46 | int error, i = device->id; |
47 | int i = device->id; | ||
48 | 47 | ||
49 | if (port[i] == SNDRV_AUTO_PORT) { | 48 | if (port[i] == SNDRV_AUTO_PORT) { |
50 | snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); | 49 | snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); |
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device) | |||
95 | return 0; | 94 | return 0; |
96 | 95 | ||
97 | out1: snd_card_free(card); | 96 | out1: snd_card_free(card); |
98 | out0: error = -EINVAL; /* FIXME: should be the original error code */ | 97 | out0: return error; |
99 | return error; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | static int __devexit snd_adlib_remove(struct platform_device *device) | 100 | static int __devexit snd_adlib_remove(struct platform_device *device) |
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(void) | |||
134 | if (IS_ERR(device)) | 132 | if (IS_ERR(device)) |
135 | continue; | 133 | continue; |
136 | 134 | ||
135 | if (!platform_get_drvdata(device)) { | ||
136 | platform_device_unregister(device); | ||
137 | continue; | ||
138 | } | ||
139 | |||
137 | devices[i] = device; | 140 | devices[i] = device; |
138 | cards++; | 141 | cards++; |
139 | } | 142 | } |