History

ASoC: fsl_esai: Add freq check in set_dai_sysclk()

The freq parameter indicates the physical frequency of an actual input clock or a desired frequency of an output clock for HCKT/R. It should never be passed 0. This might cause Division-by-zero. So this patch adds a check to fix it.

Nicolin Chen committed 8 years ago

Commit 8a2278b1 parent 728815e1 file · +6 −0Browse files

Unified · Split

sound/soc/fsl/fsl_esai.c+6−0
@@ -226,6 +226,12 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, · 225 unmodified lines
226226 unsigned long clk_rate;
227227 int ret;
228228
229+ if (freq == 0) {
230+ dev_err(dai->dev, "%sput freq of HCK%c should not be 0Hz\n",
231+ in ? "in" : "out", tx ? 'T' : 'R');
232+ return -EINVAL;
233+ }
234+
229235 /* Bypass divider settings if the requirement doesn't change */
230236 if (freq == esai_priv->hck_rate[tx] && dir == esai_priv->hck_dir[tx])
231237 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t