summaryrefslogtreecommitdiff
path: root/sound/soc/tegra/tegra20_spdif.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2023-06-08 08:27:22 +0300
committerMark Brown <broonie@kernel.org>2023-06-08 13:36:27 +0300
commit41a343cd6b7f8d0f70dd90c236086ccf8a84a7de (patch)
treeb8468dc46a5412a2687c21e8a8f38b08e855b2bd /sound/soc/tegra/tegra20_spdif.c
parent3b3a8d6d34a3ace4d49beb6f69ebb0d3cfaf0479 (diff)
downloadlinux-41a343cd6b7f8d0f70dd90c236086ccf8a84a7de.tar.xz
ASoC: tegra: Simplify code around clk_get_rate() handling
clk_get_rate() returns an unsigned long, so there is no point in storing it in a long, and test for negative values. So, turn 'parent_rate' into an unsigned long, simplify the sanity check, the error message and the return value, in case of error (i.e. 0). Doing so also turns 'i' and 'valid_rates' into unsigned long, but it is fine and harmless. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/53f928290f08f50ff43031e17fe1d88443c2c441.1686202022.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/tegra/tegra20_spdif.c')
-rw-r--r--sound/soc/tegra/tegra20_spdif.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 86bef54dfdf2..d034803695a0 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -187,13 +187,12 @@ static int tegra20_spdif_filter_rates(struct snd_pcm_hw_params *params,
struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev);
struct clk *parent = clk_get_parent(spdif->clk_spdif_out);
static const unsigned int rates[] = { 32000, 44100, 48000 };
- long i, parent_rate, valid_rates = 0;
+ unsigned long i, parent_rate, valid_rates = 0;
parent_rate = clk_get_rate(parent);
- if (parent_rate <= 0) {
- dev_err(dai->dev, "Can't get parent clock rate: %ld\n",
- parent_rate);
- return parent_rate ?: -EINVAL;
+ if (!parent_rate) {
+ dev_err(dai->dev, "Can't get parent clock rate\n");
+ return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(rates); i++) {