OpenCloudOS-Kernel/sound/soc/sh/rcar
Kuninori Morimoto cc64c390b2
ASoC: rsnd: adg: clearly handle clock error / NULL case
This driver is assuming that all adg->clk[i] is not NULL.
Because of this prerequisites, for_each_rsnd_clk() is possible to work
for all clk without checking NULL. In other words, all adg->clk[i]
should not NULL.

Some SoC might doesn't have clk_a/b/c/i. devm_clk_get() returns error in
such case. This driver calls rsnd_adg_null_clk_get() and use null_clk
instead of NULL in such cases.

But devm_clk_get() might returns NULL even though such clocks exist, but
it doesn't mean error (user deliberately chose to disable the feature).
NULL clk itself is not error from clk point of view, but is error from
this driver point of view because it is not assuming such case.

But current code is using IS_ERR() which doesn't care NULL.
This driver uses IS_ERR_OR_NULL() instead of IS_ERR() for clk check.
And it uses ERR_CAST() to clarify null_clk error.

One concern here is that it unconditionally uses null_clk if clk_a/b/c/i
was error. It is correct if it doesn't exist, but is not correct if it
returns error even though it exist.
It needs to check "clock-names" from DT before calling devm_clk_get() to
handling such case. But let's assume it is overkill so far.

Link: https://lore.kernel.org/r/YMCmhfQUimHCSH/n@mwanda
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v940wyf9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-20 13:07:26 +01:00
..
Makefile ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
adg.c ASoC: rsnd: adg: clearly handle clock error / NULL case 2021-08-20 13:07:26 +01:00
cmd.c ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
core.c ASoC: rsnd: core: make some arrays static const, makes object smaller 2021-08-20 13:07:25 +01:00
ctu.c ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
debugfs.c ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
dma.c ASoC: sh: rcar: dma: : use proper DMAENGINE API for termination 2021-07-11 23:48:38 +01:00
dvc.c ASoC: rsnd: tidyup rsnd_dma_request_channel() 2021-06-01 14:04:14 +01:00
gen.c ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
mix.c ASoC: rsnd: add debugfs support 2021-05-27 11:15:31 +01:00
rsnd.h ASoC: rsnd: tidyup __rsnd_mod_xxx macro comments 2021-06-03 13:56:42 +01:00
src.c ASoC: rsnd: adjust disabled module 2021-06-01 14:04:15 +01:00
ssi.c ASoC: rsnd: make some arrays static const, makes object smaller 2021-08-02 12:14:05 +01:00
ssiu.c ASoC: rsnd: check for zero node count 2021-06-03 13:59:59 +01:00