mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
ASoC: soc-dapm.c: tidyup snd_soc_dai_link_event_pre_pmu()
snd_soc_dai_link_event_pre_pmu() is using if/else for config->formats check, but "else" case is for just error. Unnecessary if/else is not good for readable code. this patch checks if config->formats was zero as error case. Moreover, we don't need to indicate config->formats value in error message, because it is zero. This patch tidyup it, too. => if (config->formats) { ... } else { dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", => config->formats); ... } Link: https://lore.kernel.org/all/YxiDkDOwRsbXeZ17@sirena.org.uk/ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877d2ebn3t.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
6ef8443fb1
commit
59a1063dca
1 changed files with 4 additions and 5 deletions
|
@ -3900,16 +3900,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Be a little careful as we don't want to overflow the mask array */
|
/* Be a little careful as we don't want to overflow the mask array */
|
||||||
if (config->formats) {
|
if (!config->formats) {
|
||||||
fmt = ffs(config->formats) - 1;
|
dev_warn(w->dapm->dev, "ASoC: Invalid format was specified\n");
|
||||||
} else {
|
|
||||||
dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n",
|
|
||||||
config->formats);
|
|
||||||
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt = ffs(config->formats) - 1;
|
||||||
|
|
||||||
snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt);
|
snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt);
|
||||||
hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min =
|
hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min =
|
||||||
config->rate_min;
|
config->rate_min;
|
||||||
|
|
Loading…
Reference in a new issue