aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/virmidi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/virmidi.c')
-rw-r--r--sound/drivers/virmidi.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index b178724295f3..0af88d926793 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -99,30 +99,33 @@ static int snd_virmidi_probe(struct platform_device *devptr)
99 99
100 if (midi_devs[dev] > MAX_MIDI_DEVICES) { 100 if (midi_devs[dev] > MAX_MIDI_DEVICES) {
101 snd_printk(KERN_WARNING 101 snd_printk(KERN_WARNING
102 "too much midi devices for virmidi %d: " 102 "too much midi devices for virmidi %d: force to use %d\n",
103 "force to use %d\n", dev, MAX_MIDI_DEVICES); 103 dev, MAX_MIDI_DEVICES);
104 midi_devs[dev] = MAX_MIDI_DEVICES; 104 midi_devs[dev] = MAX_MIDI_DEVICES;
105 } 105 }
106 for (idx = 0; idx < midi_devs[dev]; idx++) { 106 for (idx = 0; idx < midi_devs[dev]; idx++) {
107 struct snd_rawmidi *rmidi; 107 struct snd_rawmidi *rmidi;
108 struct snd_virmidi_dev *rdev; 108 struct snd_virmidi_dev *rdev;
109 if ((err = snd_virmidi_new(card, idx, &rmidi)) < 0) 109
110 err = snd_virmidi_new(card, idx, &rmidi);
111 if (err < 0)
110 goto __nodev; 112 goto __nodev;
111 rdev = rmidi->private_data; 113 rdev = rmidi->private_data;
112 vmidi->midi[idx] = rmidi; 114 vmidi->midi[idx] = rmidi;
113 strcpy(rmidi->name, "Virtual Raw MIDI"); 115 strcpy(rmidi->name, "Virtual Raw MIDI");
114 rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH; 116 rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH;
115 } 117 }
116 118
117 strcpy(card->driver, "VirMIDI"); 119 strcpy(card->driver, "VirMIDI");
118 strcpy(card->shortname, "VirMIDI"); 120 strcpy(card->shortname, "VirMIDI");
119 sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); 121 sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
120 122
121 if ((err = snd_card_register(card)) == 0) { 123 err = snd_card_register(card);
124 if (err) {
122 platform_set_drvdata(devptr, card); 125 platform_set_drvdata(devptr, card);
123 return 0; 126 return 0;
124 } 127 }
125 __nodev: 128__nodev:
126 snd_card_free(card); 129 snd_card_free(card);
127 return err; 130 return err;
128} 131}
@@ -157,13 +160,15 @@ static int __init alsa_card_virmidi_init(void)
157{ 160{
158 int i, cards, err; 161 int i, cards, err;
159 162
160 if ((err = platform_driver_register(&snd_virmidi_driver)) < 0) 163 err = platform_driver_register(&snd_virmidi_driver);
164 if (err < 0)
161 return err; 165 return err;
162 166
163 cards = 0; 167 cards = 0;
164 for (i = 0; i < SNDRV_CARDS; i++) { 168 for (i = 0; i < SNDRV_CARDS; i++) {
165 struct platform_device *device; 169 struct platform_device *device;
166 if (! enable[i]) 170
171 if (!enable[i])
167 continue; 172 continue;
168 device = platform_device_register_simple(SND_VIRMIDI_DRIVER, 173 device = platform_device_register_simple(SND_VIRMIDI_DRIVER,
169 i, NULL, 0); 174 i, NULL, 0);