aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-08 08:57:57 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-08 08:57:57 -0400
commit514eef9c2a711b4c24b97bb456d39695a6fe1775 (patch)
tree0d98fb13304707682faa56d136249e9177a54932 /sound
parent4836ac655410e7f126d316b0be062b38746f7529 (diff)
ALSA: ctxfi - Remove useless initializations and cast
Remove useless variable initializations and cast at the beginning of functions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ctxfi/ctamixer.c62
-rw-r--r--sound/pci/ctxfi/ctatc.c164
-rw-r--r--sound/pci/ctxfi/ctdaio.c40
-rw-r--r--sound/pci/ctxfi/cthardware.c6
-rw-r--r--sound/pci/ctxfi/cthw20k1.c82
-rw-r--r--sound/pci/ctxfi/cthw20k2.c52
-rw-r--r--sound/pci/ctxfi/ctimap.c4
-rw-r--r--sound/pci/ctxfi/ctmixer.c60
-rw-r--r--sound/pci/ctxfi/ctresource.c6
-rw-r--r--sound/pci/ctxfi/ctsrc.c110
-rw-r--r--sound/pci/ctxfi/ctvmem.c12
11 files changed, 301 insertions, 297 deletions
diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c
index 859e996ad72..a1db51b3ead 100644
--- a/sound/pci/ctxfi/ctamixer.c
+++ b/sound/pci/ctxfi/ctamixer.c
@@ -58,9 +58,9 @@ static struct rsc_ops amixer_basic_rsc_ops = {
58 58
59static int amixer_set_input(struct amixer *amixer, struct rsc *rsc) 59static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
60{ 60{
61 struct hw *hw = NULL; 61 struct hw *hw;
62 62
63 hw = (struct hw *)amixer->rsc.hw; 63 hw = amixer->rsc.hw;
64 hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE); 64 hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
65 amixer->input = rsc; 65 amixer->input = rsc;
66 if (NULL == rsc) 66 if (NULL == rsc)
@@ -75,9 +75,9 @@ static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
75/* y is a 14-bit immediate constant */ 75/* y is a 14-bit immediate constant */
76static int amixer_set_y(struct amixer *amixer, unsigned int y) 76static int amixer_set_y(struct amixer *amixer, unsigned int y)
77{ 77{
78 struct hw *hw = NULL; 78 struct hw *hw;
79 79
80 hw = (struct hw *)amixer->rsc.hw; 80 hw = amixer->rsc.hw;
81 hw->amixer_set_y(amixer->rsc.ctrl_blk, y); 81 hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
82 82
83 return 0; 83 return 0;
@@ -85,9 +85,9 @@ static int amixer_set_y(struct amixer *amixer, unsigned int y)
85 85
86static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv) 86static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
87{ 87{
88 struct hw *hw = NULL; 88 struct hw *hw;
89 89
90 hw = (struct hw *)amixer->rsc.hw; 90 hw = amixer->rsc.hw;
91 hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv); 91 hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
92 92
93 return 0; 93 return 0;
@@ -95,9 +95,9 @@ static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
95 95
96static int amixer_set_sum(struct amixer *amixer, struct sum *sum) 96static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
97{ 97{
98 struct hw *hw = NULL; 98 struct hw *hw;
99 99
100 hw = (struct hw *)amixer->rsc.hw; 100 hw = amixer->rsc.hw;
101 amixer->sum = sum; 101 amixer->sum = sum;
102 if (NULL == sum) { 102 if (NULL == sum) {
103 hw->amixer_set_se(amixer->rsc.ctrl_blk, 0); 103 hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
@@ -112,13 +112,13 @@ static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
112 112
113static int amixer_commit_write(struct amixer *amixer) 113static int amixer_commit_write(struct amixer *amixer)
114{ 114{
115 struct hw *hw = NULL; 115 struct hw *hw;
116 unsigned int index = 0; 116 unsigned int index;
117 int i = 0; 117 int i;
118 struct rsc *input = NULL; 118 struct rsc *input;
119 struct sum *sum = NULL; 119 struct sum *sum;
120 120
121 hw = (struct hw *)amixer->rsc.hw; 121 hw = amixer->rsc.hw;
122 input = amixer->input; 122 input = amixer->input;
123 sum = amixer->sum; 123 sum = amixer->sum;
124 124
@@ -158,10 +158,10 @@ static int amixer_commit_write(struct amixer *amixer)
158 158
159static int amixer_commit_raw_write(struct amixer *amixer) 159static int amixer_commit_raw_write(struct amixer *amixer)
160{ 160{
161 struct hw *hw = NULL; 161 struct hw *hw;
162 unsigned int index = 0; 162 unsigned int index;
163 163
164 hw = (struct hw *)amixer->rsc.hw; 164 hw = amixer->rsc.hw;
165 index = amixer->rsc.ops->output_slot(&amixer->rsc); 165 index = amixer->rsc.ops->output_slot(&amixer->rsc);
166 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk); 166 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
167 167
@@ -170,9 +170,9 @@ static int amixer_commit_raw_write(struct amixer *amixer)
170 170
171static int amixer_get_y(struct amixer *amixer) 171static int amixer_get_y(struct amixer *amixer)
172{ 172{
173 struct hw *hw = NULL; 173 struct hw *hw;
174 174
175 hw = (struct hw *)amixer->rsc.hw; 175 hw = amixer->rsc.hw;
176 return hw->amixer_get_y(amixer->rsc.ctrl_blk); 176 return hw->amixer_get_y(amixer->rsc.ctrl_blk);
177} 177}
178 178
@@ -201,7 +201,7 @@ static int amixer_rsc_init(struct amixer *amixer,
201 const struct amixer_desc *desc, 201 const struct amixer_desc *desc,
202 struct amixer_mgr *mgr) 202 struct amixer_mgr *mgr)
203{ 203{
204 int err = 0; 204 int err;
205 205
206 err = rsc_init(&amixer->rsc, amixer->idx[0], 206 err = rsc_init(&amixer->rsc, amixer->idx[0],
207 AMIXER, desc->msr, mgr->mgr.hw); 207 AMIXER, desc->msr, mgr->mgr.hw);
@@ -233,9 +233,9 @@ static int get_amixer_rsc(struct amixer_mgr *mgr,
233 const struct amixer_desc *desc, 233 const struct amixer_desc *desc,
234 struct amixer **ramixer) 234 struct amixer **ramixer)
235{ 235{
236 int err = 0, i = 0; 236 int err, i;
237 unsigned int idx = 0; 237 unsigned int idx;
238 struct amixer *amixer = NULL; 238 struct amixer *amixer;
239 unsigned long flags; 239 unsigned long flags;
240 240
241 *ramixer = NULL; 241 *ramixer = NULL;
@@ -284,7 +284,7 @@ error:
284static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer) 284static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
285{ 285{
286 unsigned long flags; 286 unsigned long flags;
287 int i = 0; 287 int i;
288 288
289 spin_lock_irqsave(&mgr->mgr_lock, flags); 289 spin_lock_irqsave(&mgr->mgr_lock, flags);
290 for (i = 0; i < amixer->rsc.msr; i++) 290 for (i = 0; i < amixer->rsc.msr; i++)
@@ -299,7 +299,7 @@ static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
299 299
300int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr) 300int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)
301{ 301{
302 int err = 0; 302 int err;
303 struct amixer_mgr *amixer_mgr; 303 struct amixer_mgr *amixer_mgr;
304 304
305 *ramixer_mgr = NULL; 305 *ramixer_mgr = NULL;
@@ -367,7 +367,7 @@ static int sum_rsc_init(struct sum *sum,
367 const struct sum_desc *desc, 367 const struct sum_desc *desc,
368 struct sum_mgr *mgr) 368 struct sum_mgr *mgr)
369{ 369{
370 int err = 0; 370 int err;
371 371
372 err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw); 372 err = rsc_init(&sum->rsc, sum->idx[0], SUM, desc->msr, mgr->mgr.hw);
373 if (err) 373 if (err)
@@ -388,9 +388,9 @@ static int get_sum_rsc(struct sum_mgr *mgr,
388 const struct sum_desc *desc, 388 const struct sum_desc *desc,
389 struct sum **rsum) 389 struct sum **rsum)
390{ 390{
391 int err = 0, i = 0; 391 int err, i;
392 unsigned int idx = 0; 392 unsigned int idx;
393 struct sum *sum = NULL; 393 struct sum *sum;
394 unsigned long flags; 394 unsigned long flags;
395 395
396 *rsum = NULL; 396 *rsum = NULL;
@@ -438,7 +438,7 @@ error:
438static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum) 438static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
439{ 439{
440 unsigned long flags; 440 unsigned long flags;
441 int i = 0; 441 int i;
442 442
443 spin_lock_irqsave(&mgr->mgr_lock, flags); 443 spin_lock_irqsave(&mgr->mgr_lock, flags);
444 for (i = 0; i < sum->rsc.msr; i++) 444 for (i = 0; i < sum->rsc.msr; i++)
@@ -453,7 +453,7 @@ static int put_sum_rsc(struct sum_mgr *mgr, struct sum *sum)
453 453
454int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr) 454int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr)
455{ 455{
456 int err = 0; 456 int err;
457 struct sum_mgr *sum_mgr; 457 struct sum_mgr *sum_mgr;
458 458
459 *rsum_mgr = NULL; 459 *rsum_mgr = NULL;
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index 9b1324544db..7898a375df0 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -190,8 +190,8 @@ static unsigned int convert_format(snd_pcm_format_t snd_format)
190static unsigned int 190static unsigned int
191atc_get_pitch(unsigned int input_rate, unsigned int output_rate) 191atc_get_pitch(unsigned int input_rate, unsigned int output_rate)
192{ 192{
193 unsigned int pitch = 0; 193 unsigned int pitch;
194 int b = 0; 194 int b;
195 195
196 /* get pitch and convert to fixed-point 8.24 format. */ 196 /* get pitch and convert to fixed-point 8.24 format. */
197 pitch = (input_rate / output_rate) << 24; 197 pitch = (input_rate / output_rate) << 24;
@@ -241,12 +241,12 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
241 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER]; 241 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
242 struct src_desc desc = {0}; 242 struct src_desc desc = {0};
243 struct amixer_desc mix_dsc = {0}; 243 struct amixer_desc mix_dsc = {0};
244 struct src *src = NULL; 244 struct src *src;
245 struct amixer *amixer = NULL; 245 struct amixer *amixer;
246 int err = 0; 246 int err;
247 int n_amixer = apcm->substream->runtime->channels, i = 0; 247 int n_amixer = apcm->substream->runtime->channels, i = 0;
248 int device = apcm->substream->pcm->device; 248 int device = apcm->substream->pcm->device;
249 unsigned int pitch = 0; 249 unsigned int pitch;
250 unsigned long flags; 250 unsigned long flags;
251 251
252 if (NULL != apcm->src) { 252 if (NULL != apcm->src) {
@@ -324,8 +324,8 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
324 struct srcimp_mgr *srcimp_mgr = atc->rsc_mgrs[SRCIMP]; 324 struct srcimp_mgr *srcimp_mgr = atc->rsc_mgrs[SRCIMP];
325 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER]; 325 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
326 struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM]; 326 struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
327 struct srcimp *srcimp = NULL; 327 struct srcimp *srcimp;
328 int i = 0; 328 int i;
329 329
330 if (NULL != apcm->srcimps) { 330 if (NULL != apcm->srcimps) {
331 for (i = 0; i < apcm->n_srcimp; i++) { 331 for (i = 0; i < apcm->n_srcimp; i++) {
@@ -377,7 +377,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
377 377
378static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm) 378static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
379{ 379{
380 unsigned int max_cisz = 0; 380 unsigned int max_cisz;
381 struct src *src = apcm->src; 381 struct src *src = apcm->src;
382 382
383 max_cisz = src->multi * src->rsc.msr; 383 max_cisz = src->multi * src->rsc.msr;
@@ -398,8 +398,8 @@ static int atc_pcm_playback_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
398 398
399static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm) 399static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm)
400{ 400{
401 struct src *src = NULL; 401 struct src *src;
402 int i = 0; 402 int i;
403 403
404 ct_timer_stop(apcm->timer); 404 ct_timer_stop(apcm->timer);
405 405
@@ -426,8 +426,8 @@ static int
426atc_pcm_playback_position(struct ct_atc *atc, struct ct_atc_pcm *apcm) 426atc_pcm_playback_position(struct ct_atc *atc, struct ct_atc_pcm *apcm)
427{ 427{
428 struct src *src = apcm->src; 428 struct src *src = apcm->src;
429 u32 size = 0, max_cisz = 0; 429 u32 size, max_cisz;
430 int position = 0; 430 int position;
431 431
432 position = src->ops->get_ca(src); 432 position = src->ops->get_ca(src);
433 433
@@ -449,7 +449,7 @@ struct src_node_conf_t {
449static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm, 449static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm,
450 struct src_node_conf_t *conf, int *n_srcc) 450 struct src_node_conf_t *conf, int *n_srcc)
451{ 451{
452 unsigned int pitch = 0; 452 unsigned int pitch;
453 453
454 /* get pitch and convert to fixed-point 8.24 format. */ 454 /* get pitch and convert to fixed-point 8.24 format. */
455 pitch = atc_get_pitch((atc->rsr * atc->msr), 455 pitch = atc_get_pitch((atc->rsr * atc->msr),
@@ -494,14 +494,14 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
494 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER]; 494 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
495 struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM]; 495 struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
496 struct src_desc src_dsc = {0}; 496 struct src_desc src_dsc = {0};
497 struct src *src = NULL; 497 struct src *src;
498 struct srcimp_desc srcimp_dsc = {0}; 498 struct srcimp_desc srcimp_dsc = {0};
499 struct srcimp *srcimp = NULL; 499 struct srcimp *srcimp;
500 struct amixer_desc mix_dsc = {0}; 500 struct amixer_desc mix_dsc = {0};
501 struct sum_desc sum_dsc = {0}; 501 struct sum_desc sum_dsc = {0};
502 unsigned int pitch = 0; 502 unsigned int pitch;
503 int multi = 0, err = 0, i = 0; 503 int multi, err, i;
504 int n_srcimp = 0, n_amixer = 0, n_srcc = 0, n_sum = 0; 504 int n_srcimp, n_amixer, n_srcc, n_sum;
505 struct src_node_conf_t src_node_conf[2] = {{0} }; 505 struct src_node_conf_t src_node_conf[2] = {{0} };
506 506
507 /* first release old resources */ 507 /* first release old resources */
@@ -518,8 +518,8 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
518 518
519 setup_src_node_conf(atc, apcm, src_node_conf, &n_srcc); 519 setup_src_node_conf(atc, apcm, src_node_conf, &n_srcc);
520 n_sum = (1 == multi) ? 1 : 0; 520 n_sum = (1 == multi) ? 1 : 0;
521 n_amixer += n_sum * 2 + n_srcc; 521 n_amixer = n_sum * 2 + n_srcc;
522 n_srcimp += n_srcc; 522 n_srcimp = n_srcc;
523 if ((multi > 1) && (0x8000000 >= pitch)) { 523 if ((multi > 1) && (0x8000000 >= pitch)) {
524 /* Need extra AMIXERs and SRCIMPs for special treatment 524 /* Need extra AMIXERs and SRCIMPs for special treatment
525 * of interleaved recording of conjugate channels */ 525 * of interleaved recording of conjugate channels */
@@ -633,14 +633,14 @@ error1:
633 633
634static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) 634static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
635{ 635{
636 struct src *src = NULL; 636 struct src *src;
637 struct amixer *amixer = NULL; 637 struct amixer *amixer;
638 struct srcimp *srcimp = NULL; 638 struct srcimp *srcimp;
639 struct ct_mixer *mixer = atc->mixer; 639 struct ct_mixer *mixer = atc->mixer;
640 struct sum *mono = NULL; 640 struct sum *mono;
641 struct rsc *out_ports[8] = {NULL}; 641 struct rsc *out_ports[8] = {NULL};
642 int err = 0, i = 0, j = 0, n_sum = 0, multi = 0; 642 int err, i, j, n_sum, multi;
643 unsigned int pitch = 0; 643 unsigned int pitch;
644 int mix_base = 0, imp_base = 0; 644 int mix_base = 0, imp_base = 0;
645 645
646 if (NULL != apcm->src) { 646 if (NULL != apcm->src) {
@@ -714,9 +714,9 @@ static int atc_pcm_capture_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
714 714
715static int atc_pcm_capture_start(struct ct_atc *atc, struct ct_atc_pcm *apcm) 715static int atc_pcm_capture_start(struct ct_atc *atc, struct ct_atc_pcm *apcm)
716{ 716{
717 struct src *src = NULL; 717 struct src *src;
718 struct src_mgr *src_mgr = atc->rsc_mgrs[SRC]; 718 struct src_mgr *src_mgr = atc->rsc_mgrs[SRC];
719 int i = 0, multi = 0; 719 int i, multi;
720 720
721 if (apcm->started) 721 if (apcm->started)
722 return 0; 722 return 0;
@@ -776,10 +776,10 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
776 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER]; 776 struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
777 struct src_desc desc = {0}; 777 struct src_desc desc = {0};
778 struct amixer_desc mix_dsc = {0}; 778 struct amixer_desc mix_dsc = {0};
779 struct src *src = NULL; 779 struct src *src;
780 int err = 0; 780 int err;
781 int n_amixer = apcm->substream->runtime->channels, i = 0; 781 int n_amixer = apcm->substream->runtime->channels, i;
782 unsigned int pitch = 0, rsr = atc->pll_rate; 782 unsigned int pitch, rsr = atc->pll_rate;
783 783
784 /* first release old resources */ 784 /* first release old resources */
785 atc->pcm_release_resources(atc, apcm); 785 atc->pcm_release_resources(atc, apcm);
@@ -832,15 +832,24 @@ error1:
832 return err; 832 return err;
833} 833}
834 834
835static int atc_pll_init(struct ct_atc *atc, int rate)
836{
837 struct hw *hw = atc->hw;
838 int err;
839 err = hw->pll_init(hw, rate);
840 atc->pll_rate = err ? 0 : rate;
841 return err;
842}
843
835static int 844static int
836spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm) 845spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
837{ 846{
838 struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio); 847 struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio);
839 unsigned long flags; 848 unsigned long flags;
840 unsigned int rate = apcm->substream->runtime->rate; 849 unsigned int rate = apcm->substream->runtime->rate;
841 unsigned int status = 0; 850 unsigned int status;
842 int err = 0; 851 int err;
843 unsigned char iec958_con_fs = 0; 852 unsigned char iec958_con_fs;
844 853
845 switch (rate) { 854 switch (rate) {
846 case 48000: 855 case 48000:
@@ -864,10 +873,8 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
864 dao->ops->set_spos(dao, status); 873 dao->ops->set_spos(dao, status);
865 dao->ops->commit_write(dao); 874 dao->ops->commit_write(dao);
866 } 875 }
867 if ((rate != atc->pll_rate) && (32000 != rate)) { 876 if ((rate != atc->pll_rate) && (32000 != rate))
868 err = ((struct hw *)atc->hw)->pll_init(atc->hw, rate); 877 err = atc_pll_init(atc, rate);
869 atc->pll_rate = err ? 0 : rate;
870 }
871 spin_unlock_irqrestore(&atc->atc_lock, flags); 878 spin_unlock_irqrestore(&atc->atc_lock, flags);
872 879
873 return err; 880 return err;
@@ -876,11 +883,11 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
876static int 883static int
877spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) 884spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
878{ 885{
879 struct src *src = NULL; 886 struct src *src;
880 struct amixer *amixer = NULL; 887 struct amixer *amixer;
881 struct dao *dao = NULL; 888 struct dao *dao;
882 int err = 0; 889 int err;
883 int i = 0; 890 int i;
884 unsigned long flags; 891 unsigned long flags;
885 892
886 if (NULL != apcm->src) 893 if (NULL != apcm->src)
@@ -924,7 +931,7 @@ static int atc_select_line_in(struct ct_atc *atc)
924{ 931{
925 struct hw *hw = atc->hw; 932 struct hw *hw = atc->hw;
926 struct ct_mixer *mixer = atc->mixer; 933 struct ct_mixer *mixer = atc->mixer;
927 struct src *src = NULL; 934 struct src *src;
928 935
929 if (hw->is_adc_source_selected(hw, ADC_LINEIN)) 936 if (hw->is_adc_source_selected(hw, ADC_LINEIN))
930 return 0; 937 return 0;
@@ -946,7 +953,7 @@ static int atc_select_mic_in(struct ct_atc *atc)
946{ 953{
947 struct hw *hw = atc->hw; 954 struct hw *hw = atc->hw;
948 struct ct_mixer *mixer = atc->mixer; 955 struct ct_mixer *mixer = atc->mixer;
949 struct src *src = NULL; 956 struct src *src;
950 957
951 if (hw->is_adc_source_selected(hw, ADC_MICIN)) 958 if (hw->is_adc_source_selected(hw, ADC_MICIN))
952 return 0; 959 return 0;
@@ -1063,8 +1070,8 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
1063{ 1070{
1064 unsigned long flags; 1071 unsigned long flags;
1065 struct dao_desc da_dsc = {0}; 1072 struct dao_desc da_dsc = {0};
1066 struct dao *dao = NULL; 1073 struct dao *dao;
1067 int err = 0; 1074 int err;
1068 struct ct_mixer *mixer = atc->mixer; 1075 struct ct_mixer *mixer = atc->mixer;
1069 struct rsc *rscs[2] = {NULL}; 1076 struct rsc *rscs[2] = {NULL};
1070 unsigned int spos = 0; 1077 unsigned int spos = 0;
@@ -1082,11 +1089,8 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
1082 dao->ops->set_left_input(dao, rscs[0]); 1089 dao->ops->set_left_input(dao, rscs[0]);
1083 dao->ops->set_right_input(dao, rscs[1]); 1090 dao->ops->set_right_input(dao, rscs[1]);
1084 /* Restore PLL to atc->rsr if needed. */ 1091 /* Restore PLL to atc->rsr if needed. */
1085 if (atc->pll_rate != atc->rsr) { 1092 if (atc->pll_rate != atc->rsr)
1086 err = ((struct hw *)atc->hw)->pll_init(atc->hw, 1093 err = atc_pll_init(atc, atc->rsr);
1087 atc->rsr);
1088 atc->pll_rate = err ? 0 : atc->rsr;
1089 }
1090 } 1094 }
1091 dao->ops->set_spos(dao, spos); 1095 dao->ops->set_spos(dao, spos);
1092 dao->ops->commit_write(dao); 1096 dao->ops->commit_write(dao);
@@ -1097,15 +1101,15 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state)
1097 1101
1098static int ct_atc_destroy(struct ct_atc *atc) 1102static int ct_atc_destroy(struct ct_atc *atc)
1099{ 1103{
1100 struct daio_mgr *daio_mgr = NULL; 1104 struct daio_mgr *daio_mgr;
1101 struct dao *dao = NULL; 1105 struct dao *dao;
1102 struct dai *dai = NULL; 1106 struct dai *dai;
1103 struct daio *daio = NULL; 1107 struct daio *daio;
1104 struct sum_mgr *sum_mgr = NULL; 1108 struct sum_mgr *sum_mgr;
1105 struct src_mgr *src_mgr = NULL; 1109 struct src_mgr *src_mgr;
1106 struct srcimp_mgr *srcimp_mgr = NULL; 1110 struct srcimp_mgr *srcimp_mgr;
1107 struct srcimp *srcimp = NULL; 1111 struct srcimp *srcimp;
1108 struct ct_mixer *mixer = NULL; 1112 struct ct_mixer *mixer;
1109 int i = 0; 1113 int i = 0;
1110 1114
1111 if (NULL == atc) 1115 if (NULL == atc)
@@ -1279,9 +1283,9 @@ int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
1279 1283
1280static int __devinit atc_create_hw_devs(struct ct_atc *atc) 1284static int __devinit atc_create_hw_devs(struct ct_atc *atc)
1281{ 1285{
1282 struct hw *hw = NULL; 1286 struct hw *hw;
1283 struct card_conf info = {0}; 1287 struct card_conf info = {0};
1284 int i = 0, err = 0; 1288 int i, err;
1285 1289
1286 err = create_hw_obj(atc->pci, &hw); 1290 err = create_hw_obj(atc->pci, &hw);
1287 if (err) { 1291 if (err) {
@@ -1316,14 +1320,14 @@ static int __devinit atc_create_hw_devs(struct ct_atc *atc)
1316static int __devinit atc_get_resources(struct ct_atc *atc) 1320static int __devinit atc_get_resources(struct ct_atc *atc)
1317{ 1321{
1318 struct daio_desc da_desc = {0}; 1322 struct daio_desc da_desc = {0};
1319 struct daio_mgr *daio_mgr = NULL; 1323 struct daio_mgr *daio_mgr;
1320 struct src_desc src_dsc = {0}; 1324 struct src_desc src_dsc = {0};
1321 struct src_mgr *src_mgr = NULL; 1325 struct src_mgr *src_mgr;
1322 struct srcimp_desc srcimp_dsc = {0}; 1326 struct srcimp_desc srcimp_dsc = {0};
1323 struct srcimp_mgr *srcimp_mgr = NULL; 1327 struct srcimp_mgr *srcimp_mgr;
1324 struct sum_desc sum_dsc = {0}; 1328 struct sum_desc sum_dsc = {0};
1325 struct sum_mgr *sum_mgr = NULL; 1329 struct sum_mgr *sum_mgr;
1326 int err = 0, i = 0; 1330 int err, i;
1327 unsigned short subsys_id; 1331 unsigned short subsys_id;
1328 1332
1329 atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL); 1333 atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
@@ -1428,8 +1432,8 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
1428 struct src **srcs, struct srcimp **srcimps) 1432 struct src **srcs, struct srcimp **srcimps)
1429{ 1433{
1430 struct rsc *rscs[2] = {NULL}; 1434 struct rsc *rscs[2] = {NULL};
1431 struct src *src = NULL; 1435 struct src *src;
1432 struct srcimp *srcimp = NULL; 1436 struct srcimp *srcimp;
1433 int i = 0; 1437 int i = 0;
1434 1438
1435 rscs[0] = &dai->daio.rscl; 1439 rscs[0] = &dai->daio.rscl;
@@ -1464,13 +1468,13 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
1464 1468
1465static void __devinit atc_connect_resources(struct ct_atc *atc) 1469static void __devinit atc_connect_resources(struct ct_atc *atc)
1466{ 1470{
1467 struct dai *dai = NULL; 1471 struct dai *dai;
1468 struct dao *dao = NULL; 1472 struct dao *dao;
1469 struct src *src = NULL; 1473 struct src *src;
1470 struct sum *sum = NULL; 1474 struct sum *sum;
1471 struct ct_mixer *mixer = NULL; 1475 struct ct_mixer *mixer;
1472 struct rsc *rscs[2] = {NULL}; 1476 struct rsc *rscs[2] = {NULL};
1473 int i = 0, j = 0; 1477 int i, j;
1474 1478
1475 mixer = atc->mixer; 1479 mixer = atc->mixer;
1476 1480
@@ -1553,11 +1557,11 @@ static struct ct_atc atc_preset __devinitdata = {
1553int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, 1557int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1554 unsigned int rsr, unsigned int msr, struct ct_atc **ratc) 1558 unsigned int rsr, unsigned int msr, struct ct_atc **ratc)
1555{ 1559{
1556 struct ct_atc *atc = NULL; 1560 struct ct_atc *atc;
1557 static struct snd_device_ops ops = { 1561 static struct snd_device_ops ops = {
1558 .dev_free = atc_dev_free, 1562 .dev_free = atc_dev_free,
1559 }; 1563 };
1560 int err = 0; 1564 int err;
1561 1565
1562 *ratc = NULL; 1566 *ratc = NULL;
1563 1567
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c
index a2aea399eba..befead4eeaa 100644
--- a/sound/pci/ctxfi/ctdaio.c
+++ b/sound/pci/ctxfi/ctdaio.c
@@ -168,9 +168,9 @@ static int dao_commit_write(struct dao *dao)
168 168
169static int dao_set_left_input(struct dao *dao, struct rsc *input) 169static int dao_set_left_input(struct dao *dao, struct rsc *input)
170{ 170{
171 struct imapper *entry = NULL; 171 struct imapper *entry;
172 struct daio *daio = &dao->daio; 172 struct daio *daio = &dao->daio;
173 int i = 0; 173 int i;
174 174
175 entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL); 175 entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
176 if (NULL == entry) 176 if (NULL == entry)
@@ -196,9 +196,9 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
196 196
197static int dao_set_right_input(struct dao *dao, struct rsc *input) 197static int dao_set_right_input(struct dao *dao, struct rsc *input)
198{ 198{
199 struct imapper *entry = NULL; 199 struct imapper *entry;
200 struct daio *daio = &dao->daio; 200 struct daio *daio = &dao->daio;
201 int i = 0; 201 int i;
202 202
203 entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL); 203 entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
204 if (NULL == entry) 204 if (NULL == entry)
@@ -224,9 +224,9 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
224 224
225static int dao_clear_left_input(struct dao *dao) 225static int dao_clear_left_input(struct dao *dao)
226{ 226{
227 struct imapper *entry = NULL; 227 struct imapper *entry;
228 struct daio *daio = &dao->daio; 228 struct daio *daio = &dao->daio;
229 int i = 0; 229 int i;
230 230
231 if (NULL == dao->imappers[0]) 231 if (NULL == dao->imappers[0])
232 return 0; 232 return 0;
@@ -248,9 +248,9 @@ static int dao_clear_left_input(struct dao *dao)
248 248
249static int dao_clear_right_input(struct dao *dao) 249static int dao_clear_right_input(struct dao *dao)
250{ 250{
251 struct imapper *entry = NULL; 251 struct imapper *entry;
252 struct daio *daio = &dao->daio; 252 struct daio *daio = &dao->daio;
253 int i = 0; 253 int i;
254 254
255 if (NULL == dao->imappers[daio->rscl.msr]) 255 if (NULL == dao->imappers[daio->rscl.msr])
256 return 0; 256 return 0;
@@ -299,7 +299,7 @@ static int dai_set_srt_srcr(struct dai *dai, struct rsc *src)
299 299
300static int dai_set_srt_msr(struct dai *dai, unsigned int msr) 300static int dai_set_srt_msr(struct dai *dai, unsigned int msr)
301{ 301{
302 unsigned int rsr = 0; 302 unsigned int rsr;
303 303
304 for (rsr = 0; msr > 1; msr >>= 1) 304 for (rsr = 0; msr > 1; msr >>= 1)
305 rsr++; 305 rsr++;
@@ -340,8 +340,8 @@ static int daio_rsc_init(struct daio *daio,
340 const struct daio_desc *desc, 340 const struct daio_desc *desc,
341 void *hw) 341 void *hw)
342{ 342{
343 int err = 0; 343 int err;
344 unsigned int idx_l = 0, idx_r = 0; 344 unsigned int idx_l, idx_r;
345 345
346 switch (((struct hw *)hw)->get_chip_type(hw)) { 346 switch (((struct hw *)hw)->get_chip_type(hw)) {
347 case ATC20K1: 347 case ATC20K1:
@@ -400,8 +400,8 @@ static int dao_rsc_init(struct dao *dao,
400 struct daio_mgr *mgr) 400 struct daio_mgr *mgr)
401{ 401{
402 struct hw *hw = mgr->mgr.hw; 402 struct hw *hw = mgr->mgr.hw;
403 unsigned int conf = 0; 403 unsigned int conf;
404 int err = 0; 404 int err;
405 405
406 err = daio_rsc_init(&dao->daio, desc, mgr->mgr.hw); 406 err = daio_rsc_init(&dao->daio, desc, mgr->mgr.hw);
407 if (err) 407 if (err)
@@ -423,7 +423,7 @@ static int dao_rsc_init(struct dao *dao,
423 daio_device_index(dao->daio.type, hw)); 423 daio_device_index(dao->daio.type, hw));
424 hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk); 424 hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk);
425 425
426 conf |= (desc->msr & 0x7) | (desc->passthru << 3); 426 conf = (desc->msr & 0x7) | (desc->passthru << 3);
427 hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk, 427 hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk,
428 daio_device_index(dao->daio.type, hw), conf); 428 daio_device_index(dao->daio.type, hw), conf);
429 hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, 429 hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk,
@@ -475,9 +475,9 @@ static int dai_rsc_init(struct dai *dai,
475 const struct daio_desc *desc, 475 const struct daio_desc *desc,
476 struct daio_mgr *mgr) 476 struct daio_mgr *mgr)
477{ 477{
478 int err = 0; 478 int err;
479 struct hw *hw = mgr->mgr.hw; 479 struct hw *hw = mgr->mgr.hw;
480 unsigned int rsr = 0, msr = 0; 480 unsigned int rsr, msr;
481 481
482 err = daio_rsc_init(&dai->daio, desc, mgr->mgr.hw); 482 err = daio_rsc_init(&dai->daio, desc, mgr->mgr.hw);
483 if (err) 483 if (err)
@@ -536,7 +536,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
536 const struct daio_desc *desc, 536 const struct daio_desc *desc,
537 struct daio **rdaio) 537 struct daio **rdaio)
538{ 538{
539 int err = 0; 539 int err;
540 struct dai *dai = NULL; 540 struct dai *dai = NULL;
541 struct dao *dao = NULL; 541 struct dao *dao = NULL;
542 unsigned long flags; 542 unsigned long flags;
@@ -660,7 +660,7 @@ static int daio_map_op(void *data, struct imapper *entry)
660static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry) 660static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
661{ 661{
662 unsigned long flags; 662 unsigned long flags;
663 int err = 0; 663 int err;
664 664
665 spin_lock_irqsave(&mgr->imap_lock, flags); 665 spin_lock_irqsave(&mgr->imap_lock, flags);
666 if ((0 == entry->addr) && (mgr->init_imap_added)) { 666 if ((0 == entry->addr) && (mgr->init_imap_added)) {
@@ -677,7 +677,7 @@ static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry)
677static int daio_imap_delete(struct daio_mgr *mgr, struct imapper *entry) 677static int daio_imap_delete(struct daio_mgr *mgr, struct imapper *entry)
678{ 678{
679 unsigned long flags; 679 unsigned long flags;
680 int err = 0; 680 int err;
681 681
682 spin_lock_irqsave(&mgr->imap_lock, flags); 682 spin_lock_irqsave(&mgr->imap_lock, flags);
683 err = input_mapper_delete(&mgr->imappers, entry, daio_map_op, mgr); 683 err = input_mapper_delete(&mgr->imappers, entry, daio_map_op, mgr);
@@ -701,7 +701,7 @@ static int daio_mgr_commit_write(struct daio_mgr *mgr)
701 701
702int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr) 702int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr)
703{ 703{
704 int err = 0, i = 0; 704 int err, i;
705 struct daio_mgr *daio_mgr; 705 struct daio_mgr *daio_mgr;
706 struct imapper *entry; 706 struct imapper *entry;
707 707
diff --git a/sound/pci/ctxfi/cthardware.c b/sound/pci/ctxfi/cthardware.c
index 53d1acadc0e..5ec6813d391 100644
--- a/sound/pci/ctxfi/cthardware.c
+++ b/sound/pci/ctxfi/cthardware.c
@@ -22,7 +22,7 @@
22 22
23static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw) 23static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
24{ 24{
25 enum CHIPTYP type = ATCNONE; 25 enum CHIPTYP type;
26 26
27 switch (hw->pci->device) { 27 switch (hw->pci->device) {
28 case 0x0005: /* 20k1 device */ 28 case 0x0005: /* 20k1 device */
@@ -41,7 +41,7 @@ static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
41 41
42int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw) 42int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
43{ 43{
44 int err = 0; 44 int err;
45 45
46 switch (pci->device) { 46 switch (pci->device) {
47 case 0x0005: /* 20k1 device */ 47 case 0x0005: /* 20k1 device */
@@ -65,7 +65,7 @@ int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
65 65
66int destroy_hw_obj(struct hw *hw) 66int destroy_hw_obj(struct hw *hw)
67{ 67{
68 int err = 0; 68 int err;
69 69
70 switch (hw->pci->device) { 70 switch (hw->pci->device) {
71 case 0x0005: /* 20k1 device */ 71 case 0x0005: /* 20k1 device */
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index b165466e1a5..38b87b6ee6d 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -369,7 +369,7 @@ static unsigned int src_param_pitch_mixer(unsigned int src_idx)
369static int src_commit_write(struct hw *hw, unsigned int idx, void *blk) 369static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
370{ 370{
371 struct src_rsc_ctrl_blk *ctl = blk; 371 struct src_rsc_ctrl_blk *ctl = blk;
372 int i = 0; 372 int i;
373 373
374 if (ctl->dirty.bf.czbfs) { 374 if (ctl->dirty.bf.czbfs) {
375 /* Clear Z-Buffer registers */ 375 /* Clear Z-Buffer registers */
@@ -468,8 +468,8 @@ static int src_mgr_dsb_src(void *blk, unsigned int idx)
468static int src_mgr_commit_write(struct hw *hw, void *blk) 468static int src_mgr_commit_write(struct hw *hw, void *blk)
469{ 469{
470 struct src_mgr_ctrl_blk *ctl = blk; 470 struct src_mgr_ctrl_blk *ctl = blk;
471 int i = 0; 471 int i;
472 unsigned int ret = 0; 472 unsigned int ret;
473 473
474 if (ctl->dirty.bf.enbsa) { 474 if (ctl->dirty.bf.enbsa) {
475 do { 475 do {
@@ -1108,7 +1108,7 @@ static int daio_mgr_set_imapaddr(void *blk, unsigned int addr)
1108static int daio_mgr_commit_write(struct hw *hw, void *blk) 1108static int daio_mgr_commit_write(struct hw *hw, void *blk)
1109{ 1109{
1110 struct daio_mgr_ctrl_blk *ctl = blk; 1110 struct daio_mgr_ctrl_blk *ctl = blk;
1111 int i = 0; 1111 int i;
1112 1112
1113 if (ctl->dirty.bf.i2sictl || ctl->dirty.bf.i2soctl) { 1113 if (ctl->dirty.bf.i2sictl || ctl->dirty.bf.i2soctl) {
1114 for (i = 0; i < 4; i++) { 1114 for (i = 0; i < 4; i++) {
@@ -1212,8 +1212,8 @@ struct trn_conf {
1212 1212
1213static int hw_daio_init(struct hw *hw, const struct daio_conf *info) 1213static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
1214{ 1214{
1215 u32 i2sorg = 0; 1215 u32 i2sorg;
1216 u32 spdorg = 0; 1216 u32 spdorg;
1217 1217
1218 /* Read I2S CTL. Keep original value. */ 1218 /* Read I2S CTL. Keep original value. */
1219 /*i2sorg = hw_read_20kx(hw, I2SCTL);*/ 1219 /*i2sorg = hw_read_20kx(hw, I2SCTL);*/
@@ -1263,8 +1263,8 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
1263/* TRANSPORT operations */ 1263/* TRANSPORT operations */
1264static int hw_trn_init(struct hw *hw, const struct trn_conf *info) 1264static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
1265{ 1265{
1266 u32 trnctl = 0; 1266 u32 trnctl;
1267 unsigned long ptp_phys_low = 0, ptp_phys_high = 0; 1267 u32 ptp_phys_low, ptp_phys_high;
1268 1268
1269 /* Set up device page table */ 1269 /* Set up device page table */
1270 if ((~0UL) == info->vm_pgt_phys) { 1270 if ((~0UL) == info->vm_pgt_phys) {
@@ -1316,7 +1316,7 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
1316static int hw_pll_init(struct hw *hw, unsigned int rsr) 1316static int hw_pll_init(struct hw *hw, unsigned int rsr)
1317{ 1317{
1318 unsigned int pllctl; 1318 unsigned int pllctl;
1319 int i = 0; 1319 int i;
1320 1320
1321 pllctl = (48000 == rsr) ? 0x1480a001 : 0x1480a731; 1321 pllctl = (48000 == rsr) ? 0x1480a001 : 0x1480a731;
1322 for (i = 0; i < 3; i++) { 1322 for (i = 0; i < 3; i++) {
@@ -1384,7 +1384,7 @@ static void i2c_lock(struct hw *hw)
1384 1384
1385static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data) 1385static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data)
1386{ 1386{
1387 unsigned int ret = 0; 1387 unsigned int ret;
1388 1388
1389 do { 1389 do {
1390 ret = hw_read_pci(hw, 0xEC); 1390 ret = hw_read_pci(hw, 0xEC);
@@ -1397,9 +1397,9 @@ static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data)
1397 1397
1398static int hw_reset_dac(struct hw *hw) 1398static int hw_reset_dac(struct hw *hw)
1399{ 1399{
1400 u32 i = 0; 1400 u32 i;
1401 u16 gpioorg = 0; 1401 u16 gpioorg;
1402 unsigned int ret = 0; 1402 unsigned int ret;
1403 1403
1404 if (i2c_unlock(hw)) 1404 if (i2c_unlock(hw))
1405 return -1; 1405 return -1;
@@ -1430,10 +1430,10 @@ static int hw_reset_dac(struct hw *hw)
1430 1430
1431static int hw_dac_init(struct hw *hw, const struct dac_conf *info) 1431static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
1432{ 1432{
1433 u32 data = 0; 1433 u32 data;
1434 u16 gpioorg = 0; 1434 u16 gpioorg;
1435 u16 subsys_id = 0; 1435 u16 subsys_id;
1436 unsigned int ret = 0; 1436 unsigned int ret;
1437 1437
1438 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); 1438 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
1439 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { 1439 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
@@ -1494,13 +1494,12 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
1494 1494
1495static int is_adc_input_selected_SB055x(struct hw *hw, enum ADCSRC type) 1495static int is_adc_input_selected_SB055x(struct hw *hw, enum ADCSRC type)
1496{ 1496{
1497 u32 data = 0; 1497 return 0;
1498 return data;
1499} 1498}
1500 1499
1501static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type) 1500static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type)
1502{ 1501{
1503 u32 data = 0; 1502 u32 data;
1504 1503
1505 data = hw_read_20kx(hw, GPIO); 1504 data = hw_read_20kx(hw, GPIO);
1506 switch (type) { 1505 switch (type) {
@@ -1521,7 +1520,7 @@ static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type)
1521 1520
1522static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type) 1521static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
1523{ 1522{
1524 u32 data = 0; 1523 u32 data;
1525 1524
1526 data = hw_read_20kx(hw, GPIO); 1525 data = hw_read_20kx(hw, GPIO);
1527 switch (type) { 1526 switch (type) {
@@ -1539,7 +1538,7 @@ static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
1539 1538
1540static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) 1539static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
1541{ 1540{
1542 u16 subsys_id = 0; 1541 u16 subsys_id;
1543 1542
1544 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); 1543 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
1545 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { 1544 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
@@ -1559,7 +1558,7 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
1559static int 1558static int
1560adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost) 1559adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost)
1561{ 1560{
1562 u32 data = 0; 1561 u32 data;
1563 1562
1564 /* 1563 /*
1565 * check and set the following GPIO bits accordingly 1564 * check and set the following GPIO bits accordingly
@@ -1599,9 +1598,9 @@ adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost)
1599static int 1598static int
1600adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost) 1599adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost)
1601{ 1600{
1602 u32 data = 0; 1601 u32 data;
1603 u32 i2c_data = 0; 1602 u32 i2c_data;
1604 unsigned int ret = 0; 1603 unsigned int ret;
1605 1604
1606 if (i2c_unlock(hw)) 1605 if (i2c_unlock(hw))
1607 return -1; 1606 return -1;
@@ -1649,9 +1648,9 @@ adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost)
1649static int 1648static int
1650adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost) 1649adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
1651{ 1650{
1652 u32 data = 0; 1651 u32 data;
1653 u32 i2c_data = 0; 1652 u32 i2c_data;
1654 unsigned int ret = 0; 1653 unsigned int ret;
1655 1654
1656 if (i2c_unlock(hw)) 1655 if (i2c_unlock(hw))
1657 return -1; 1656 return -1;
@@ -1693,7 +1692,7 @@ adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
1693 1692
1694static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) 1693static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
1695{ 1694{
1696 u16 subsys_id = 0; 1695 u16 subsys_id;
1697 1696
1698 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); 1697 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
1699 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { 1698 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
@@ -1719,8 +1718,8 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
1719{ 1718{
1720 u16 gpioorg; 1719 u16 gpioorg;
1721 u16 input_source; 1720 u16 input_source;
1722 u32 adcdata = 0; 1721 u32 adcdata;
1723 unsigned int ret = 0; 1722 unsigned int ret;
1724 1723
1725 input_source = 0x100; /* default to analog */ 1724 input_source = 0x100; /* default to analog */
1726 switch (input) { 1725 switch (input) {
@@ -1742,6 +1741,7 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
1742 input_source = 0x0; /* set to Digital */ 1741 input_source = 0x0; /* set to Digital */
1743 break; 1742 break;
1744 default: 1743 default:
1744 adcdata = 0x0;
1745 break; 1745 break;
1746 } 1746 }
1747 1747
@@ -1781,8 +1781,8 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
1781 1781
1782static int hw_adc_init(struct hw *hw, const struct adc_conf *info) 1782static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
1783{ 1783{
1784 int err = 0; 1784 int err;
1785 u16 subsys_id = 0; 1785 u16 subsys_id;
1786 1786
1787 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); 1787 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
1788 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { 1788 if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
@@ -1797,7 +1797,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
1797 1797
1798static int hw_have_digit_io_switch(struct hw *hw) 1798static int hw_have_digit_io_switch(struct hw *hw)
1799{ 1799{
1800 u16 subsys_id = 0; 1800 u16 subsys_id;
1801 1801
1802 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); 1802 pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
1803 /* SB073x and Vista compatible cards have no digit IO switch */ 1803 /* SB073x and Vista compatible cards have no digit IO switch */
@@ -1814,11 +1814,11 @@ static int uaa_to_xfi(struct pci_dev *pci)
1814{ 1814{
1815 unsigned int bar0, bar1, bar2, bar3, bar4, bar5; 1815 unsigned int bar0, bar1, bar2, bar3, bar4, bar5;
1816 unsigned int cmd, irq, cl_size, l_timer, pwr; 1816 unsigned int cmd, irq, cl_size, l_timer, pwr;
1817 unsigned int is_uaa = 0; 1817 unsigned int is_uaa;
1818 unsigned int data[4] = {0}; 1818 unsigned int data[4] = {0};
1819 unsigned int io_base; 1819 unsigned int io_base;
1820 void *mem_base; 1820 void *mem_base;
1821 int i = 0; 1821 int i;
1822 const u32 CTLX = CTLBITS('C', 'T', 'L', 'X'); 1822 const u32 CTLX = CTLBITS('C', 'T', 'L', 'X');
1823 const u32 CTL_ = CTLBITS('C', 'T', 'L', '-'); 1823 const u32 CTL_ = CTLBITS('C', 'T', 'L', '-');
1824 const u32 CTLF = CTLBITS('C', 'T', 'L', 'F'); 1824 const u32 CTLF = CTLBITS('C', 'T', 'L', 'F');
@@ -1916,9 +1916,9 @@ static irqreturn_t ct_20k1_interrupt(int irq, void *dev_id)
1916 1916
1917static int hw_card_start(struct hw *hw) 1917static int hw_card_start(struct hw *hw)
1918{ 1918{
1919 int err = 0; 1919 int err;
1920 struct pci_dev *pci = hw->pci; 1920 struct pci_dev *pci = hw->pci;
1921 u16 subsys_id = 0; 1921 u16 subsys_id;
1922 1922
1923 err = pci_enable_device(pci); 1923 err = pci_enable_device(pci);
1924 if (err < 0) 1924 if (err < 0)
@@ -2004,8 +2004,8 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
2004{ 2004{
2005 int err; 2005 int err;
2006 unsigned int gctl; 2006 unsigned int gctl;
2007 u16 subsys_id = 0; 2007 u16 subsys_id;
2008 u32 data = 0; 2008 u32 data;
2009 struct dac_conf dac_info = {0}; 2009 struct dac_conf dac_info = {0};
2010 struct adc_conf adc_info = {0}; 2010 struct adc_conf adc_info = {0};
2011 struct daio_conf daio_info = {0}; 2011 struct daio_conf daio_info = {0};
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index edbfb482746..7d6dcbaf524 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)
168 168
169static int src_put_rsc_ctrl_blk(void *blk) 169static int src_put_rsc_ctrl_blk(void *blk)
170{ 170{
171 kfree((struct src_rsc_ctrl_blk *)blk); 171 kfree(blk);
172 172
173 return 0; 173 return 0;
174} 174}
@@ -359,7 +359,7 @@ static unsigned int src_param_pitch_mixer(unsigned int src_idx)
359static int src_commit_write(struct hw *hw, unsigned int idx, void *blk) 359static int src_commit_write(struct hw *hw, unsigned int idx, void *blk)
360{ 360{
361 struct src_rsc_ctrl_blk *ctl = blk; 361 struct src_rsc_ctrl_blk *ctl = blk;
362 int i = 0; 362 int i;
363 363
364 if (ctl->dirty.bf.czbfs) { 364 if (ctl->dirty.bf.czbfs) {
365 /* Clear Z-Buffer registers */ 365 /* Clear Z-Buffer registers */
@@ -458,8 +458,8 @@ static int src_mgr_dsb_src(void *blk, unsigned int idx)
458static int src_mgr_commit_write(struct hw *hw, void *blk) 458static int src_mgr_commit_write(struct hw *hw, void *blk)
459{ 459{
460 struct src_mgr_ctrl_blk *ctl = blk; 460 struct src_mgr_ctrl_blk *ctl = blk;
461 int i = 0; 461 int i;
462 unsigned int ret = 0; 462 unsigned int ret;
463 463
464 if (ctl->dirty.bf.enbsa) { 464 if (ctl->dirty.bf.enbsa) {
465 do { 465 do {
@@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)
494 494
495static int src_mgr_put_ctrl_blk(void *blk) 495static int src_mgr_put_ctrl_blk(void *blk)
496{ 496{
497 kfree((struct src_mgr_ctrl_blk *)blk); 497 kfree(blk);
498 498
499 return 0; 499 return 0;
500} 500}
@@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)
515 515
516static int srcimp_mgr_put_ctrl_blk(void *blk) 516static int srcimp_mgr_put_ctrl_blk(void *blk)
517{ 517{
518 kfree((struct srcimp_mgr_ctrl_blk *)blk); 518 kfree(blk);
519 519
520 return 0; 520 return 0;
521} 521}
@@ -704,7 +704,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)
704 704
705static int amixer_rsc_put_ctrl_blk(void *blk) 705static int amixer_rsc_put_ctrl_blk(void *blk)
706{ 706{
707 kfree((struct amixer_rsc_ctrl_blk *)blk); 707 kfree(blk);
708 708
709 return 0; 709 return 0;
710} 710}
@@ -893,7 +893,7 @@ static int dai_get_ctrl_blk(void **rblk)
893 893
894static int dai_put_ctrl_blk(void *blk) 894static int dai_put_ctrl_blk(void *blk)
895{ 895{
896 kfree((struct dai_ctrl_blk *)blk); 896 kfree(blk);
897 897
898 return 0; 898 return 0;
899} 899}
@@ -943,7 +943,7 @@ static int dao_get_ctrl_blk(void **rblk)
943 943
944static int dao_put_ctrl_blk(void *blk) 944static int dao_put_ctrl_blk(void *blk)
945{ 945{
946 kfree((struct dao_ctrl_blk *)blk); 946 kfree(blk);
947 947
948 return 0; 948 return 0;
949} 949}
@@ -1051,8 +1051,8 @@ static int daio_mgr_set_imapaddr(void *blk, unsigned int addr)
1051static int daio_mgr_commit_write(struct hw *hw, void *blk) 1051static int daio_mgr_commit_write(struct hw *hw, void *blk)
1052{ 1052{
1053 struct daio_mgr_ctrl_blk *ctl = blk; 1053 struct daio_mgr_ctrl_blk *ctl = blk;
1054 unsigned int data = 0; 1054 unsigned int data;
1055 int i = 0; 1055 int i;
1056 1056
1057 for (i = 0; i < 8; i++) { 1057 for (i = 0; i < 8; i++) {
1058 if ((ctl->dirty.bf.atxctl & (0x1 << i))) { 1058 if ((ctl->dirty.bf.atxctl & (0x1 << i))) {
@@ -1080,7 +1080,7 @@ static int daio_mgr_commit_write(struct hw *hw, void *blk)
1080static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) 1080static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
1081{ 1081{
1082 struct daio_mgr_ctrl_blk *blk; 1082 struct daio_mgr_ctrl_blk *blk;
1083 int i = 0; 1083 int i;
1084 1084
1085 *rblk = NULL; 1085 *rblk = NULL;
1086 blk = kzalloc(sizeof(*blk), GFP_KERNEL); 1086 blk = kzalloc(sizeof(*blk), GFP_KERNEL);
@@ -1099,7 +1099,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
1099 1099
1100static int daio_mgr_put_ctrl_blk(void *blk) 1100static int daio_mgr_put_ctrl_blk(void *blk)
1101{ 1101{
1102 kfree((struct daio_mgr_ctrl_blk *)blk); 1102 kfree(blk);
1103 1103
1104 return 0; 1104 return 0;
1105} 1105}
@@ -1125,7 +1125,7 @@ struct trn_conf {
1125 1125
1126static int hw_daio_init(struct hw *hw, const struct daio_conf *info) 1126static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
1127{ 1127{
1128 u32 dwData = 0; 1128 u32 dwData;
1129 int i; 1129 int i;
1130 1130
1131 /* Program I2S with proper sample rate and enable the correct I2S 1131 /* Program I2S with proper sample rate and enable the correct I2S
@@ -1195,9 +1195,9 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
1195/* TRANSPORT operations */ 1195/* TRANSPORT operations */
1196static int hw_trn_init(struct hw *hw, const struct trn_conf *info) 1196static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
1197{ 1197{
1198 u32 vmctl = 0, data = 0; 1198 u32 vmctl, data;
1199 unsigned long ptp_phys_low = 0, ptp_phys_high = 0; 1199 u32 ptp_phys_low, ptp_phys_high;
1200 int i = 0; 1200 int i;
1201 1201
1202 /* Set up device page table */ 1202 /* Set up device page table */
1203 if ((~0UL) == info->vm_pgt_phys) { 1203 if ((~0UL) == info->vm_pgt_phys) {
@@ -1433,7 +1433,7 @@ static int I2CLockChip(struct hw *hw)
1433 1433
1434static int I2CInit(struct hw *hw, u8 bDeviceID, u8 bAddressSize, u8 bDataSize) 1434static int I2CInit(struct hw *hw, u8 bDeviceID, u8 bAddressSize, u8 bDataSize)
1435{ 1435{
1436 int err = 0; 1436 int err;
1437 unsigned int RegI2CStatus; 1437 unsigned int RegI2CStatus;
1438 unsigned int RegI2CAddress; 1438 unsigned int RegI2CAddress;
1439 1439
@@ -1481,7 +1481,7 @@ static int I2CUninit(struct hw *hw)
1481static int I2CWaitDataReady(struct hw *hw) 1481static int I2CWaitDataReady(struct hw *hw)
1482{ 1482{
1483 int i = 0x400000; 1483 int i = 0x400000;
1484 unsigned int ret = 0; 1484 unsigned int ret;
1485 1485
1486 do { 1486 do {
1487 ret = hw_read_20kx(hw, I2C_IF_STATUS); 1487 ret = hw_read_20kx(hw, I2C_IF_STATUS);
@@ -1541,9 +1541,9 @@ static int I2CWrite(struct hw *hw, u16 wAddress, u32 dwData)
1541 1541
1542static int hw_dac_init(struct hw *hw, const struct dac_conf *info) 1542static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
1543{ 1543{
1544 int err = 0; 1544 int err;
1545 u32 dwData = 0; 1545 u32 dwData;
1546 int i = 0; 1546 int i;
1547 struct REGS_CS4382 cs4382_Read = {0}; 1547 struct REGS_CS4382 cs4382_Read = {0};
1548 struct REGS_CS4382 cs4382_Def = { 1548 struct REGS_CS4382 cs4382_Def = {
1549 0x00000001, /* Mode Control 1 */ 1549 0x00000001, /* Mode Control 1 */
@@ -1696,7 +1696,7 @@ End:
1696 1696
1697static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) 1697static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
1698{ 1698{
1699 u32 data = 0; 1699 u32 data;
1700 1700
1701 data = hw_read_20kx(hw, GPIO_DATA); 1701 data = hw_read_20kx(hw, GPIO_DATA);
1702 switch (type) { 1702 switch (type) {
@@ -1714,7 +1714,7 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
1714 1714
1715static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) 1715static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
1716{ 1716{
1717 u32 data = 0; 1717 u32 data;
1718 1718
1719 data = hw_read_20kx(hw, GPIO_DATA); 1719 data = hw_read_20kx(hw, GPIO_DATA);
1720 switch (type) { 1720 switch (type) {
@@ -1747,8 +1747,8 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
1747 1747
1748static int hw_adc_init(struct hw *hw, const struct adc_conf *info) 1748static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
1749{ 1749{
1750 int err = 0; 1750 int err;
1751 u32 dwMux = 2, dwData = 0, dwCtl = 0; 1751 u32 dwMux = 2, dwData, dwCtl;
1752 1752
1753 /* Set ADC reset bit as output */ 1753 /* Set ADC reset bit as output */
1754 dwData = hw_read_20kx(hw, GPIO_CTRL); 1754 dwData = hw_read_20kx(hw, GPIO_CTRL);
diff --git a/sound/pci/ctxfi/ctimap.c b/sound/pci/ctxfi/ctimap.c
index d34eacd902c..0b73368a4df 100644
--- a/sound/pci/ctxfi/ctimap.c
+++ b/sound/pci/ctxfi/ctimap.c
@@ -99,8 +99,8 @@ int input_mapper_delete(struct list_head *mappers, struct imapper *entry,
99 99
100void free_input_mapper_list(struct list_head *head) 100void free_input_mapper_list(struct list_head *head)
101{ 101{
102 struct imapper *entry = NULL; 102 struct imapper *entry;
103 struct list_head *pos = NULL; 103 struct list_head *pos;
104 104
105 while (!list_empty(head)) { 105 while (!list_empty(head)) {
106 pos = head->next; 106 pos = head->next;
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index 796156e4bd3..666722d9de4 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -298,7 +298,7 @@ set_switch_state(struct ct_mixer *mixer,
298 * from 2^-6 to (1+1023/1024) */ 298 * from 2^-6 to (1+1023/1024) */
299static unsigned int uint16_to_float14(unsigned int x) 299static unsigned int uint16_to_float14(unsigned int x)
300{ 300{
301 unsigned int i = 0; 301 unsigned int i;
302 302
303 if (x < 17) 303 if (x < 17)
304 return 0; 304 return 0;
@@ -318,7 +318,7 @@ static unsigned int uint16_to_float14(unsigned int x)
318 318
319static unsigned int float14_to_uint16(unsigned int x) 319static unsigned int float14_to_uint16(unsigned int x)
320{ 320{
321 unsigned int e = 0; 321 unsigned int e;
322 322
323 if (!x) 323 if (!x)
324 return x; 324 return x;
@@ -491,7 +491,7 @@ static int ct_alsa_mix_switch_put(struct snd_kcontrol *kcontrol,
491 struct ct_atc *atc = snd_kcontrol_chip(kcontrol); 491 struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
492 struct ct_mixer *mixer = atc->mixer; 492 struct ct_mixer *mixer = atc->mixer;
493 enum CTALSA_MIXER_CTL type = kcontrol->private_value; 493 enum CTALSA_MIXER_CTL type = kcontrol->private_value;
494 int state = 0; 494 int state;
495 495
496 state = ucontrol->value.integer.value[0]; 496 state = ucontrol->value.integer.value[0];
497 if (get_switch_state(mixer, type) == state) 497 if (get_switch_state(mixer, type) == state)
@@ -574,7 +574,7 @@ static int ct_spdif_get(struct snd_kcontrol *kcontrol,
574 struct snd_ctl_elem_value *ucontrol) 574 struct snd_ctl_elem_value *ucontrol)
575{ 575{
576 struct ct_atc *atc = snd_kcontrol_chip(kcontrol); 576 struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
577 unsigned int status = 0; 577 unsigned int status;
578 578
579 atc->spdif_out_get_status(atc, &status); 579 atc->spdif_out_get_status(atc, &status);
580 ucontrol->value.iec958.status[0] = (status >> 0) & 0xff; 580 ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
@@ -589,8 +589,8 @@ static int ct_spdif_put(struct snd_kcontrol *kcontrol,
589 struct snd_ctl_elem_value *ucontrol) 589 struct snd_ctl_elem_value *ucontrol)
590{ 590{
591 struct ct_atc *atc = snd_kcontrol_chip(kcontrol); 591 struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
592 int change = 1; 592 int change;
593 unsigned int status = 0, old_status = 0; 593 unsigned int status, old_status;
594 594
595 status = (ucontrol->value.iec958.status[0] << 0) | 595 status = (ucontrol->value.iec958.status[0] << 0) |
596 (ucontrol->value.iec958.status[1] << 8) | 596 (ucontrol->value.iec958.status[1] << 8) |
@@ -641,8 +641,8 @@ static struct snd_kcontrol_new iec958_ctl = {
641static int 641static int
642ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new) 642ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new)
643{ 643{
644 struct snd_kcontrol *kctl = NULL; 644 struct snd_kcontrol *kctl;
645 int err = 0; 645 int err;
646 646
647 kctl = snd_ctl_new1(new, mixer->atc); 647 kctl = snd_ctl_new1(new, mixer->atc);
648 if (NULL == kctl) 648 if (NULL == kctl)
@@ -669,9 +669,9 @@ ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new)
669 669
670static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) 670static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
671{ 671{
672 enum CTALSA_MIXER_CTL type = 0; 672 enum CTALSA_MIXER_CTL type;
673 struct ct_atc *atc = mixer->atc; 673 struct ct_atc *atc = mixer->atc;
674 int err = 0; 674 int err;
675 675
676 /* Create snd kcontrol instances on demand */ 676 /* Create snd kcontrol instances on demand */
677 for (type = VOL_MIXER_START; type <= VOL_MIXER_END; type++) { 677 for (type = VOL_MIXER_START; type <= VOL_MIXER_END; type++) {
@@ -733,9 +733,9 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
733static void 733static void
734ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type) 734ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
735{ 735{
736 struct amixer *amix_d = NULL; 736 struct amixer *amix_d;
737 struct sum *sum_c = NULL; 737 struct sum *sum_c;
738 int i = 0; 738 int i;
739 739
740 for (i = 0; i < 2; i++) { 740 for (i = 0; i < 2; i++) {
741 amix_d = mixer->amixers[type*CHN_NUM+i]; 741 amix_d = mixer->amixers[type*CHN_NUM+i];
@@ -748,8 +748,8 @@ ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
748static void 748static void
749ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type) 749ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
750{ 750{
751 struct amixer *amix_d = NULL; 751 struct amixer *amix_d;
752 int i = 0; 752 int i;
753 753
754 for (i = 0; i < 2; i++) { 754 for (i = 0; i < 2; i++) {
755 amix_d = mixer->amixers[type*CHN_NUM+i]; 755 amix_d = mixer->amixers[type*CHN_NUM+i];
@@ -760,14 +760,14 @@ ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type)
760 760
761static int ct_mixer_get_resources(struct ct_mixer *mixer) 761static int ct_mixer_get_resources(struct ct_mixer *mixer)
762{ 762{
763 struct sum_mgr *sum_mgr = NULL; 763 struct sum_mgr *sum_mgr;
764 struct sum *sum = NULL; 764 struct sum *sum;
765 struct sum_desc sum_desc = {0}; 765 struct sum_desc sum_desc = {0};
766 struct amixer_mgr *amixer_mgr = NULL; 766 struct amixer_mgr *amixer_mgr;
767 struct amixer *amixer = NULL; 767 struct amixer *amixer;
768 struct amixer_desc am_desc = {0}; 768 struct amixer_desc am_desc = {0};
769 int err = 0; 769 int err;
770 int i = 0; 770 int i;
771 771
772 /* Allocate sum resources for mixer obj */ 772 /* Allocate sum resources for mixer obj */
773 sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM]; 773 sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
@@ -822,8 +822,8 @@ error1:
822 822
823static int ct_mixer_get_mem(struct ct_mixer **rmixer) 823static int ct_mixer_get_mem(struct ct_mixer **rmixer)
824{ 824{
825 struct ct_mixer *mixer = NULL; 825 struct ct_mixer *mixer;
826 int err = 0; 826 int err;
827 827
828 *rmixer = NULL; 828 *rmixer = NULL;
829 /* Allocate mem for mixer obj */ 829 /* Allocate mem for mixer obj */
@@ -855,9 +855,9 @@ error1:
855 855
856static int ct_mixer_topology_build(struct ct_mixer *mixer) 856static int ct_mixer_topology_build(struct ct_mixer *mixer)
857{ 857{
858 struct sum *sum = NULL; 858 struct sum *sum;
859 struct amixer *amix_d = NULL, *amix_s = NULL; 859 struct amixer *amix_d, *amix_s;
860 enum CT_AMIXER_CTL i = 0, j = 0; 860 enum CT_AMIXER_CTL i, j;
861 861
862 /* Build topology from destination to source */ 862 /* Build topology from destination to source */
863 863
@@ -1044,7 +1044,7 @@ int ct_mixer_destroy(struct ct_mixer *mixer)
1044 struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM]; 1044 struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
1045 struct amixer_mgr *amixer_mgr = 1045 struct amixer_mgr *amixer_mgr =
1046 (struct amixer_mgr *)mixer->atc->rsc_mgrs[AMIXER]; 1046 (struct amixer_mgr *)mixer->atc->rsc_mgrs[AMIXER];
1047 struct amixer *amixer = NULL; 1047 struct amixer *amixer;
1048 int i = 0; 1048 int i = 0;
1049 1049
1050 /* Release amixer resources */ 1050 /* Release amixer resources */
@@ -1071,8 +1071,8 @@ int ct_mixer_destroy(struct ct_mixer *mixer)
1071 1071
1072int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer) 1072int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer)
1073{ 1073{
1074 struct ct_mixer *mixer = NULL; 1074 struct ct_mixer *mixer;
1075 int err = 0; 1075 int err;
1076 1076
1077 *rmixer = NULL; 1077 *rmixer = NULL;
1078 1078
@@ -1109,7 +1109,7 @@ int ct_alsa_mix_create(struct ct_atc *atc,
1109 enum CTALSADEVS device, 1109 enum CTALSADEVS device,
1110 const char *device_name) 1110 const char *device_name)
1111{ 1111{
1112 int err = 0; 1112 int err;
1113 1113
1114 /* Create snd kcontrol instances on demand */ 1114 /* Create snd kcontrol instances on demand */
1115 /* vol_ctl.device = swh_ctl.device = device; */ /* better w/ device 0 */ 1115 /* vol_ctl.device = swh_ctl.device = device; */ /* better w/ device 0 */
diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c
index da21a717a07..889c495bb7d 100644
--- a/sound/pci/ctxfi/ctresource.c
+++ b/sound/pci/ctxfi/ctresource.c
@@ -27,7 +27,7 @@ static int
27get_resource(u8 *rscs, unsigned int amount, 27get_resource(u8 *rscs, unsigned int amount,
28 unsigned int multi, unsigned int *ridx) 28 unsigned int multi, unsigned int *ridx)
29{ 29{
30 int i = 0, j = 0, k = 0, n = 0; 30 int i, j, k, n;
31 31
32 /* Check whether there are sufficient resources to meet request. */ 32 /* Check whether there are sufficient resources to meet request. */
33 for (i = 0, n = multi; i < amount; i++) { 33 for (i = 0, n = multi; i < amount; i++) {
@@ -61,7 +61,7 @@ get_resource(u8 *rscs, unsigned int amount,
61 61
62static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx) 62static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx)
63{ 63{
64 unsigned int i = 0, j = 0, k = 0, n = 0; 64 unsigned int i, j, k, n;
65 65
66 /* Mark the contiguous bits in resource bit-map as used */ 66 /* Mark the contiguous bits in resource bit-map as used */
67 for (n = multi, i = idx; n > 0; n--) { 67 for (n = multi, i = idx; n > 0; n--) {
@@ -76,7 +76,7 @@ static int put_resource(u8 *rscs, unsigned int multi, unsigned int idx)
76 76
77int mgr_get_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int *ridx) 77int mgr_get_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int *ridx)
78{ 78{
79 int err = 0; 79 int err;
80 80
81 if (n > mgr->avail) 81 if (n > mgr->avail)
82 return -ENOENT; 82 return -ENOENT;
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index 77e118c5bc9..e1c145d8b70 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -37,9 +37,9 @@ static int (*src_default_config[3])(struct src *) = {
37 37
38static int src_set_state(struct src *src, unsigned int state) 38static int src_set_state(struct src *src, unsigned int state)
39{ 39{
40 struct hw *hw = NULL; 40 struct hw *hw;
41 41
42 hw = (struct hw *)src->rsc.hw; 42 hw = src->rsc.hw;
43 hw->src_set_state(src->rsc.ctrl_blk, state); 43 hw->src_set_state(src->rsc.ctrl_blk, state);
44 44
45 return 0; 45 return 0;
@@ -47,9 +47,9 @@ static int src_set_state(struct src *src, unsigned int state)
47 47
48static int src_set_bm(struct src *src, unsigned int bm) 48static int src_set_bm(struct src *src, unsigned int bm)
49{ 49{
50 struct hw *hw = NULL; 50 struct hw *hw;
51 51
52 hw = (struct hw *)src->rsc.hw; 52 hw = src->rsc.hw;
53 hw->src_set_bm(src->rsc.ctrl_blk, bm); 53 hw->src_set_bm(src->rsc.ctrl_blk, bm);
54 54
55 return 0; 55 return 0;
@@ -57,9 +57,9 @@ static int src_set_bm(struct src *src, unsigned int bm)
57 57
58static int src_set_sf(struct src *src, unsigned int sf) 58static int src_set_sf(struct src *src, unsigned int sf)
59{ 59{
60 struct hw *hw = NULL; 60 struct hw *hw;
61 61
62 hw = (struct hw *)src->rsc.hw; 62 hw = src->rsc.hw;
63 hw->src_set_sf(src->rsc.ctrl_blk, sf); 63 hw->src_set_sf(src->rsc.ctrl_blk, sf);
64 64
65 return 0; 65 return 0;
@@ -67,9 +67,9 @@ static int src_set_sf(struct src *src, unsigned int sf)
67 67
68static int src_set_pm(struct src *src, unsigned int pm) 68static int src_set_pm(struct src *src, unsigned int pm)
69{ 69{
70 struct hw *hw = NULL; 70 struct hw *hw;
71 71
72 hw = (struct hw *)src->rsc.hw; 72 hw = src->rsc.hw;
73 hw->src_set_pm(src->rsc.ctrl_blk, pm); 73 hw->src_set_pm(src->rsc.ctrl_blk, pm);
74 74
75 return 0; 75 return 0;
@@ -77,9 +77,9 @@ static int src_set_pm(struct src *src, unsigned int pm)
77 77
78static int src_set_rom(struct src *src, unsigned int rom) 78static int src_set_rom(struct src *src, unsigned int rom)
79{ 79{
80 struct hw *hw = NULL; 80 struct hw *hw;
81 81
82 hw = (struct hw *)src->rsc.hw; 82 hw = src->rsc.hw;
83 hw->src_set_rom(src->rsc.ctrl_blk, rom); 83 hw->src_set_rom(src->rsc.ctrl_blk, rom);
84 84
85 return 0; 85 return 0;
@@ -87,9 +87,9 @@ static int src_set_rom(struct src *src, unsigned int rom)
87 87
88static int src_set_vo(struct src *src, unsigned int vo) 88static int src_set_vo(struct src *src, unsigned int vo)
89{ 89{
90 struct hw *hw = NULL; 90 struct hw *hw;
91 91
92 hw = (struct hw *)src->rsc.hw; 92 hw = src->rsc.hw;
93 hw->src_set_vo(src->rsc.ctrl_blk, vo); 93 hw->src_set_vo(src->rsc.ctrl_blk, vo);
94 94
95 return 0; 95 return 0;
@@ -97,9 +97,9 @@ static int src_set_vo(struct src *src, unsigned int vo)
97 97
98static int src_set_st(struct src *src, unsigned int st) 98static int src_set_st(struct src *src, unsigned int st)
99{ 99{
100 struct hw *hw = NULL; 100 struct hw *hw;
101 101
102 hw = (struct hw *)src->rsc.hw; 102 hw = src->rsc.hw;
103 hw->src_set_st(src->rsc.ctrl_blk, st); 103 hw->src_set_st(src->rsc.ctrl_blk, st);
104 104
105 return 0; 105 return 0;
@@ -107,9 +107,9 @@ static int src_set_st(struct src *src, unsigned int st)
107 107
108static int src_set_bp(struct src *src, unsigned int bp) 108static int src_set_bp(struct src *src, unsigned int bp)
109{ 109{
110 struct hw *hw = NULL; 110 struct hw *hw;
111 111
112 hw = (struct hw *)src->rsc.hw; 112 hw = src->rsc.hw;
113 hw->src_set_bp(src->rsc.ctrl_blk, bp); 113 hw->src_set_bp(src->rsc.ctrl_blk, bp);
114 114
115 return 0; 115 return 0;
@@ -117,9 +117,9 @@ static int src_set_bp(struct src *src, unsigned int bp)
117 117
118static int src_set_cisz(struct src *src, unsigned int cisz) 118static int src_set_cisz(struct src *src, unsigned int cisz)
119{ 119{
120 struct hw *hw = NULL; 120 struct hw *hw;
121 121
122 hw = (struct hw *)src->rsc.hw; 122 hw = src->rsc.hw;
123 hw->src_set_cisz(src->rsc.ctrl_blk, cisz); 123 hw->src_set_cisz(src->rsc.ctrl_blk, cisz);
124 124
125 return 0; 125 return 0;
@@ -127,9 +127,9 @@ static int src_set_cisz(struct src *src, unsigned int cisz)
127 127
128static int src_set_ca(struct src *src, unsigned int ca) 128static int src_set_ca(struct src *src, unsigned int ca)
129{ 129{
130 struct hw *hw = NULL; 130 struct hw *hw;
131 131
132 hw = (struct hw *)src->rsc.hw; 132 hw = src->rsc.hw;
133 hw->src_set_ca(src->rsc.ctrl_blk, ca); 133 hw->src_set_ca(src->rsc.ctrl_blk, ca);
134 134
135 return 0; 135 return 0;
@@ -137,9 +137,9 @@ static int src_set_ca(struct src *src, unsigned int ca)
137 137
138static int src_set_sa(struct src *src, unsigned int sa) 138static int src_set_sa(struct src *src, unsigned int sa)
139{ 139{
140 struct hw *hw = NULL; 140 struct hw *hw;
141 141
142 hw = (struct hw *)src->rsc.hw; 142 hw = src->rsc.hw;
143 hw->src_set_sa(src->rsc.ctrl_blk, sa); 143 hw->src_set_sa(src->rsc.ctrl_blk, sa);
144 144
145 return 0; 145 return 0;
@@ -147,9 +147,9 @@ static int src_set_sa(struct src *src, unsigned int sa)
147 147
148static int src_set_la(struct src *src, unsigned int la) 148static int src_set_la(struct src *src, unsigned int la)
149{ 149{
150 struct hw *hw = NULL; 150 struct hw *hw;
151 151
152 hw = (struct hw *)src->rsc.hw; 152 hw = src->rsc.hw;
153 hw->src_set_la(src->rsc.ctrl_blk, la); 153 hw->src_set_la(src->rsc.ctrl_blk, la);
154 154
155 return 0; 155 return 0;
@@ -157,9 +157,9 @@ static int src_set_la(struct src *src, unsigned int la)
157 157
158static int src_set_pitch(struct src *src, unsigned int pitch) 158static int src_set_pitch(struct src *src, unsigned int pitch)
159{ 159{
160 struct hw *hw = NULL; 160 struct hw *hw;
161 161
162 hw = (struct hw *)src->rsc.hw; 162 hw = src->rsc.hw;
163 hw->src_set_pitch(src->rsc.ctrl_blk, pitch); 163 hw->src_set_pitch(src->rsc.ctrl_blk, pitch);
164 164
165 return 0; 165 return 0;
@@ -167,9 +167,9 @@ static int src_set_pitch(struct src *src, unsigned int pitch)
167 167
168static int src_set_clear_zbufs(struct src *src) 168static int src_set_clear_zbufs(struct src *src)
169{ 169{
170 struct hw *hw = NULL; 170 struct hw *hw;
171 171
172 hw = (struct hw *)src->rsc.hw; 172 hw = src->rsc.hw;
173 hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1); 173 hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1);
174 174
175 return 0; 175 return 0;
@@ -177,11 +177,11 @@ static int src_set_clear_zbufs(struct src *src)
177 177
178static int src_commit_write(struct src *src) 178static int src_commit_write(struct src *src)
179{ 179{
180 struct hw *hw = NULL; 180 struct hw *hw;
181 int i = 0; 181 int i;
182 unsigned int dirty = 0; 182 unsigned int dirty = 0;
183 183
184 hw = (struct hw *)src->rsc.hw; 184 hw = src->rsc.hw;
185 src->rsc.ops->master(&src->rsc); 185 src->rsc.ops->master(&src->rsc);
186 if (src->rsc.msr > 1) { 186 if (src->rsc.msr > 1) {
187 /* Save dirty flags for conjugate resource programming */ 187 /* Save dirty flags for conjugate resource programming */
@@ -207,9 +207,9 @@ static int src_commit_write(struct src *src)
207 207
208static int src_get_ca(struct src *src) 208static int src_get_ca(struct src *src)
209{ 209{
210 struct hw *hw = NULL; 210 struct hw *hw;
211 211
212 hw = (struct hw *)src->rsc.hw; 212 hw = src->rsc.hw;
213 return hw->src_get_ca(hw, src->rsc.ops->index(&src->rsc), 213 return hw->src_get_ca(hw, src->rsc.ops->index(&src->rsc),
214 src->rsc.ctrl_blk); 214 src->rsc.ctrl_blk);
215} 215}
@@ -229,7 +229,7 @@ static struct src *src_next_interleave(struct src *src)
229static int src_default_config_memrd(struct src *src) 229static int src_default_config_memrd(struct src *src)
230{ 230{
231 struct hw *hw = src->rsc.hw; 231 struct hw *hw = src->rsc.hw;
232 unsigned int rsr = 0, msr = 0; 232 unsigned int rsr, msr;
233 233
234 hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF); 234 hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
235 hw->src_set_bm(src->rsc.ctrl_blk, 1); 235 hw->src_set_bm(src->rsc.ctrl_blk, 1);
@@ -297,7 +297,7 @@ static int src_default_config_memwr(struct src *src)
297static int src_default_config_arcrw(struct src *src) 297static int src_default_config_arcrw(struct src *src)
298{ 298{
299 struct hw *hw = src->rsc.hw; 299 struct hw *hw = src->rsc.hw;
300 unsigned int rsr = 0, msr = 0; 300 unsigned int rsr, msr;
301 unsigned int dirty; 301 unsigned int dirty;
302 302
303 hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF); 303 hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
@@ -360,8 +360,8 @@ static int
360src_rsc_init(struct src *src, u32 idx, 360src_rsc_init(struct src *src, u32 idx,
361 const struct src_desc *desc, struct src_mgr *mgr) 361 const struct src_desc *desc, struct src_mgr *mgr)
362{ 362{
363 int err = 0; 363 int err;
364 int i = 0, n = 0; 364 int i, n;
365 struct src *p; 365 struct src *p;
366 366
367 n = (MEMRD == desc->mode) ? desc->multi : 1; 367 n = (MEMRD == desc->mode) ? desc->multi : 1;
@@ -395,7 +395,7 @@ error1:
395 395
396static int src_rsc_uninit(struct src *src, struct src_mgr *mgr) 396static int src_rsc_uninit(struct src *src, struct src_mgr *mgr)
397{ 397{
398 int i = 0, n = 0; 398 int i, n;
399 struct src *p; 399 struct src *p;
400 400
401 n = (MEMRD == src->mode) ? src->multi : 1; 401 n = (MEMRD == src->mode) ? src->multi : 1;
@@ -416,8 +416,8 @@ static int
416get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc) 416get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
417{ 417{
418 unsigned int idx = SRC_RESOURCE_NUM; 418 unsigned int idx = SRC_RESOURCE_NUM;
419 int err = 0; 419 int err;
420 struct src *src = NULL; 420 struct src *src;
421 unsigned long flags; 421 unsigned long flags;
422 422
423 *rsrc = NULL; 423 *rsrc = NULL;
@@ -489,7 +489,7 @@ static int put_src_rsc(struct src_mgr *mgr, struct src *src)
489static int src_enable_s(struct src_mgr *mgr, struct src *src) 489static int src_enable_s(struct src_mgr *mgr, struct src *src)
490{ 490{
491 struct hw *hw = mgr->mgr.hw; 491 struct hw *hw = mgr->mgr.hw;
492 int i = 0; 492 int i;
493 493
494 src->rsc.ops->master(&src->rsc); 494 src->rsc.ops->master(&src->rsc);
495 for (i = 0; i < src->rsc.msr; i++) { 495 for (i = 0; i < src->rsc.msr; i++) {
@@ -505,7 +505,7 @@ static int src_enable_s(struct src_mgr *mgr, struct src *src)
505static int src_enable(struct src_mgr *mgr, struct src *src) 505static int src_enable(struct src_mgr *mgr, struct src *src)
506{ 506{
507 struct hw *hw = mgr->mgr.hw; 507 struct hw *hw = mgr->mgr.hw;
508 int i = 0; 508 int i;
509 509
510 src->rsc.ops->master(&src->rsc); 510 src->rsc.ops->master(&src->rsc);
511 for (i = 0; i < src->rsc.msr; i++) { 511 for (i = 0; i < src->rsc.msr; i++) {
@@ -521,7 +521,7 @@ static int src_enable(struct src_mgr *mgr, struct src *src)
521static int src_disable(struct src_mgr *mgr, struct src *src) 521static int src_disable(struct src_mgr *mgr, struct src *src)
522{ 522{
523 struct hw *hw = mgr->mgr.hw; 523 struct hw *hw = mgr->mgr.hw;
524 int i = 0; 524 int i;
525 525
526 src->rsc.ops->master(&src->rsc); 526 src->rsc.ops->master(&src->rsc);
527 for (i = 0; i < src->rsc.msr; i++) { 527 for (i = 0; i < src->rsc.msr; i++) {
@@ -545,7 +545,7 @@ static int src_mgr_commit_write(struct src_mgr *mgr)
545 545
546int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr) 546int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr)
547{ 547{
548 int err = 0, i = 0; 548 int err, i;
549 struct src_mgr *src_mgr; 549 struct src_mgr *src_mgr;
550 550
551 *rsrc_mgr = NULL; 551 *rsrc_mgr = NULL;
@@ -618,8 +618,8 @@ static struct rsc_ops srcimp_basic_rsc_ops = {
618 618
619static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input) 619static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
620{ 620{
621 struct imapper *entry = NULL; 621 struct imapper *entry;
622 int i = 0; 622 int i;
623 623
624 srcimp->rsc.ops->master(&srcimp->rsc); 624 srcimp->rsc.ops->master(&srcimp->rsc);
625 src->rsc.ops->master(&src->rsc); 625 src->rsc.ops->master(&src->rsc);
@@ -646,7 +646,7 @@ static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
646 646
647static int srcimp_unmap(struct srcimp *srcimp) 647static int srcimp_unmap(struct srcimp *srcimp)
648{ 648{
649 int i = 0; 649 int i;
650 650
651 /* Program master and conjugate resources */ 651 /* Program master and conjugate resources */
652 for (i = 0; i < srcimp->rsc.msr; i++) { 652 for (i = 0; i < srcimp->rsc.msr; i++) {
@@ -669,7 +669,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
669 const struct srcimp_desc *desc, 669 const struct srcimp_desc *desc,
670 struct srcimp_mgr *mgr) 670 struct srcimp_mgr *mgr)
671{ 671{
672 int err = 0; 672 int err;
673 673
674 err = rsc_init(&srcimp->rsc, srcimp->idx[0], 674 err = rsc_init(&srcimp->rsc, srcimp->idx[0],
675 SRCIMP, desc->msr, mgr->mgr.hw); 675 SRCIMP, desc->msr, mgr->mgr.hw);
@@ -715,9 +715,9 @@ static int get_srcimp_rsc(struct srcimp_mgr *mgr,
715 const struct srcimp_desc *desc, 715 const struct srcimp_desc *desc,
716 struct srcimp **rsrcimp) 716 struct srcimp **rsrcimp)
717{ 717{
718 int err = 0, i = 0; 718 int err, i;
719 unsigned int idx = 0; 719 unsigned int idx;
720 struct srcimp *srcimp = NULL; 720 struct srcimp *srcimp;
721 unsigned long flags; 721 unsigned long flags;
722 722
723 *rsrcimp = NULL; 723 *rsrcimp = NULL;
@@ -765,7 +765,7 @@ error1:
765static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp) 765static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp)
766{ 766{
767 unsigned long flags; 767 unsigned long flags;
768 int i = 0; 768 int i;
769 769
770 spin_lock_irqsave(&mgr->mgr_lock, flags); 770 spin_lock_irqsave(&mgr->mgr_lock, flags);
771 for (i = 0; i < srcimp->rsc.msr; i++) 771 for (i = 0; i < srcimp->rsc.msr; i++)
@@ -795,7 +795,7 @@ static int srcimp_map_op(void *data, struct imapper *entry)
795static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry) 795static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
796{ 796{
797 unsigned long flags; 797 unsigned long flags;
798 int err = 0; 798 int err;
799 799
800 spin_lock_irqsave(&mgr->imap_lock, flags); 800 spin_lock_irqsave(&mgr->imap_lock, flags);
801 if ((0 == entry->addr) && (mgr->init_imap_added)) { 801 if ((0 == entry->addr) && (mgr->init_imap_added)) {
@@ -812,7 +812,7 @@ static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
812static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry) 812static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
813{ 813{
814 unsigned long flags; 814 unsigned long flags;
815 int err = 0; 815 int err;
816 816
817 spin_lock_irqsave(&mgr->imap_lock, flags); 817 spin_lock_irqsave(&mgr->imap_lock, flags);
818 err = input_mapper_delete(&mgr->imappers, entry, srcimp_map_op, mgr); 818 err = input_mapper_delete(&mgr->imappers, entry, srcimp_map_op, mgr);
@@ -828,7 +828,7 @@ static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
828 828
829int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr) 829int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr)
830{ 830{
831 int err = 0; 831 int err;
832 struct srcimp_mgr *srcimp_mgr; 832 struct srcimp_mgr *srcimp_mgr;
833 struct imapper *entry; 833 struct imapper *entry;
834 834
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
index b7f8e58ae07..67665a7e43c 100644
--- a/sound/pci/ctxfi/ctvmem.c
+++ b/sound/pci/ctxfi/ctvmem.c
@@ -31,8 +31,8 @@
31static struct ct_vm_block * 31static struct ct_vm_block *
32get_vm_block(struct ct_vm *vm, unsigned int size) 32get_vm_block(struct ct_vm *vm, unsigned int size)
33{ 33{
34 struct ct_vm_block *block = NULL, *entry = NULL; 34 struct ct_vm_block *block = NULL, *entry;
35 struct list_head *pos = NULL; 35 struct list_head *pos;
36 36
37 size = CT_PAGE_ALIGN(size); 37 size = CT_PAGE_ALIGN(size);
38 if (size > vm->size) { 38 if (size > vm->size) {
@@ -77,8 +77,8 @@ get_vm_block(struct ct_vm *vm, unsigned int size)
77 77
78static void put_vm_block(struct ct_vm *vm, struct ct_vm_block *block) 78static void put_vm_block(struct ct_vm *vm, struct ct_vm_block *block)
79{ 79{
80 struct ct_vm_block *entry = NULL, *pre_ent = NULL; 80 struct ct_vm_block *entry, *pre_ent;
81 struct list_head *pos = NULL, *pre = NULL; 81 struct list_head *pos, *pre;
82 82
83 block->size = CT_PAGE_ALIGN(block->size); 83 block->size = CT_PAGE_ALIGN(block->size);
84 84
@@ -223,8 +223,8 @@ int ct_vm_create(struct ct_vm **rvm)
223void ct_vm_destroy(struct ct_vm *vm) 223void ct_vm_destroy(struct ct_vm *vm)
224{ 224{
225 int i; 225 int i;
226 struct list_head *pos = NULL; 226 struct list_head *pos;
227 struct ct_vm_block *entry = NULL; 227 struct ct_vm_block *entry;
228 228
229 /* free used and unused list nodes */ 229 /* free used and unused list nodes */
230 while (!list_empty(&vm->used)) { 230 while (!list_empty(&vm->used)) {