Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221546
b: refs/heads/master
c: bb617ee
h: refs/heads/master
v: v3
  • Loading branch information
Jesper Juhl authored and Takashi Iwai committed Nov 1, 2010
1 parent 1d70527 commit b462d92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a8d56b2a2f9aa423c3d8b6b1e2792c0492059ed
refs/heads/master: bb617ee3f82ba94072c8b08043d9166bbfe397a2
33 changes: 11 additions & 22 deletions trunk/sound/pci/cs46xx/dsp_spos.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,39 +225,25 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
{
struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL);

if (ins == NULL)
if (ins == NULL)
return NULL;

/* better to use vmalloc for this big table */
ins->symbol_table.nsymbols = 0;
ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) *
DSP_MAX_SYMBOLS);
ins->symbol_table.highest_frag_index = 0;

if (ins->symbol_table.symbols == NULL) {
ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) {
cs46xx_dsp_spos_destroy(chip);
goto error;
}

ins->symbol_table.nsymbols = 0;
ins->symbol_table.highest_frag_index = 0;
ins->code.offset = 0;
ins->code.size = 0;
ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);

if (ins->code.data == NULL) {
cs46xx_dsp_spos_destroy(chip);
goto error;
}

ins->nscb = 0;
ins->ntask = 0;

ins->nmodules = 0;
ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);

if (ins->modules == NULL) {
cs46xx_dsp_spos_destroy(chip);
goto error;
}

/* default SPDIF input sample rate
to 48000 khz */
Expand All @@ -271,8 +257,8 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)

/* set left and right validity bits and
default channel status */
ins->spdif_csuv_default =
ins->spdif_csuv_stream =
ins->spdif_csuv_default =
ins->spdif_csuv_stream =
/* byte 0 */ ((unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF & 0xff)) << 24) |
/* byte 1 */ ((unsigned int)_wrap_all_bits( ((SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff)) << 16) |
/* byte 3 */ (unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF >> 24) & 0xff) |
Expand All @@ -281,6 +267,9 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
return ins;

error:
kfree(ins->modules);
kfree(ins->code.data);
vfree(ins->symbol_table.symbols);
kfree(ins);
return NULL;
}
Expand Down

0 comments on commit b462d92

Please sign in to comment.