aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2008-08-15 06:59:02 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-15 06:59:02 -0400
commit1a11cb6427e65b7cfc9c3ec6eaecd2dba1f2d69a (patch)
treeb2b325124e8cdd6311bf18b78991ecfd652e226e
parent54e8e21ed21ca8788aa75294067494abebf9d550 (diff)
ALSA: dummy driver - do not use assignment in if condition
checkpatch.pl does not like assignment in if condition Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--sound/drivers/dummy.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 4f900d8b92ce..e5e749f3e0ef 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -47,9 +47,11 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}");
47static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) 47static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
48{ 48{
49 int err; 49 int err;
50 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 50 err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
51 if (err < 0)
51 return err; 52 return err;
52 if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0) 53 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX);
54 if (err) < 0)
53 return err; 55 return err;
54 return 0; 56 return 0;
55} 57}
@@ -363,7 +365,8 @@ static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream)
363 } 365 }
364 if (substream->pcm->device & 2) 366 if (substream->pcm->device & 2)
365 runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); 367 runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
366 if ((err = add_playback_constraints(runtime)) < 0) 368 err = add_playback_constraints(runtime);
369 if (err < 0)
367 return err; 370 return err;
368 371
369 return 0; 372 return 0;
@@ -387,7 +390,8 @@ static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream)
387 } 390 }
388 if (substream->pcm->device & 2) 391 if (substream->pcm->device & 2)
389 runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); 392 runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
390 if ((err = add_capture_constraints(runtime)) < 0) 393 err = add_capture_constraints(runtime);
394 if (err < 0)
391 return err; 395 return err;
392 396
393 return 0; 397 return 0;
@@ -431,8 +435,9 @@ static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
431 struct snd_pcm *pcm; 435 struct snd_pcm *pcm;
432 int err; 436 int err;
433 437
434 if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device, 438 err = snd_pcm_new(dummy->card, "Dummy PCM", device,
435 substreams, substreams, &pcm)) < 0) 439 substreams, substreams, &pcm);
440 if (err < 0)
436 return err; 441 return err;
437 dummy->pcm = pcm; 442 dummy->pcm = pcm;
438 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops); 443 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops);
@@ -569,7 +574,8 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
569 strcpy(card->mixername, "Dummy Mixer"); 574 strcpy(card->mixername, "Dummy Mixer");
570 575
571 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) { 576 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
572 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy))) < 0) 577 err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy));
578 if (err < 0)
573 return err; 579 return err;
574 } 580 }
575 return 0; 581 return 0;
@@ -593,10 +599,12 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
593 pcm_substreams[dev] = 1; 599 pcm_substreams[dev] = 1;
594 if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS) 600 if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
595 pcm_substreams[dev] = MAX_PCM_SUBSTREAMS; 601 pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
596 if ((err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev])) < 0) 602 err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev]);
603 if (err < 0)
597 goto __nodev; 604 goto __nodev;
598 } 605 }
599 if ((err = snd_card_dummy_new_mixer(dummy)) < 0) 606 err = snd_card_dummy_new_mixer(dummy);
607 if (err < 0)
600 goto __nodev; 608 goto __nodev;
601 strcpy(card->driver, "Dummy"); 609 strcpy(card->driver, "Dummy");
602 strcpy(card->shortname, "Dummy"); 610 strcpy(card->shortname, "Dummy");
@@ -604,7 +612,8 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
604 612
605 snd_card_set_dev(card, &devptr->dev); 613 snd_card_set_dev(card, &devptr->dev);
606 614
607 if ((err = snd_card_register(card)) == 0) { 615 err = snd_card_register(card);
616 if (err == 0) {
608 platform_set_drvdata(devptr, card); 617 platform_set_drvdata(devptr, card);
609 return 0; 618 return 0;
610 } 619 }
@@ -667,7 +676,8 @@ static int __init alsa_card_dummy_init(void)
667{ 676{
668 int i, cards, err; 677 int i, cards, err;
669 678
670 if ((err = platform_driver_register(&snd_dummy_driver)) < 0) 679 err = platform_driver_register(&snd_dummy_driver);
680 if (err < 0)
671 return err; 681 return err;
672 682
673 cards = 0; 683 cards = 0;