Skip to content

Commit

Permalink
drivers: dai: intel: dmic: don't use assert for error handling
Browse files Browse the repository at this point in the history
The dai.h interface does not prohibit calling dai_config_get()
with different direction values. The dmic driver should handle
invalid direction value explicitly and not rely on an assert.

Link: thesofproject/sof#6896
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
  • Loading branch information
kv2019i committed Dec 30, 2022
1 parent d320100 commit 96366a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/dai/intel/dmic/dmic.c
Expand Up @@ -743,7 +743,9 @@ static const struct dai_config *dai_dmic_get_config(const struct device *dev, en
{
struct dai_intel_dmic *dmic = (struct dai_intel_dmic *)dev->data;

__ASSERT_NO_MSG(dir == DAI_DIR_RX);
if (dir != DAI_DIR_RX)
return NULL;

return &dmic->dai_config_params;
}

Expand Down

0 comments on commit 96366a3

Please sign in to comment.