tunnels: fix netns vs proto registration ordering
[safe/jmp/linux-2.6] / sound / spi / at73c213.c
index aa57115..4c7b051 100644 (file)
@@ -210,7 +210,13 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream)
 {
        struct snd_at73c213 *chip = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
+       int err;
 
+       /* ensure buffer_size is a multiple of period_size */
+       err = snd_pcm_hw_constraint_integer(runtime,
+                                       SNDRV_PCM_HW_PARAM_PERIODS);
+       if (err < 0)
+               return err;
        snd_at73c213_playback_hw.rate_min = chip->bitrate;
        snd_at73c213_playback_hw.rate_max = chip->bitrate;
        runtime->hw = snd_at73c213_playback_hw;
@@ -959,12 +965,11 @@ static int __devinit snd_at73c213_probe(struct spi_device *spi)
                return PTR_ERR(board->dac_clk);
        }
 
-       retval = -ENOMEM;
-
        /* Allocate "card" using some unused identifiers. */
        snprintf(id, sizeof id, "at73c213_%d", board->ssc_id);
-       card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct snd_at73c213));
-       if (!card)
+       retval = snd_card_create(-1, id, THIS_MODULE,
+                                sizeof(struct snd_at73c213), &card);
+       if (retval < 0)
                goto out;
 
        chip = card->private_data;