Commit 86c60804 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

firmware: cs_dsp: Perform NULL check in cs_dsp_coeff_write/read_ctrl

Add a NULL check to the cs_dsp_coeff_write/read_ctrl functions. This is
a major convenience for users of the cs_dsp library as it allows the call
to cs_dsp_get_ctl to be inlined with the call to read/write the control
itself.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211117132300.1290-7-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent dcee7676
...@@ -758,6 +758,9 @@ int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, const void *buf, size_ ...@@ -758,6 +758,9 @@ int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, const void *buf, size_
lockdep_assert_held(&ctl->dsp->pwr_lock); lockdep_assert_held(&ctl->dsp->pwr_lock);
if (!ctl)
return -ENOENT;
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
ret = -EPERM; ret = -EPERM;
else if (buf != ctl->cache) else if (buf != ctl->cache)
...@@ -817,6 +820,9 @@ int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, void *buf, size_t len) ...@@ -817,6 +820,9 @@ int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, void *buf, size_t len)
lockdep_assert_held(&ctl->dsp->pwr_lock); lockdep_assert_held(&ctl->dsp->pwr_lock);
if (!ctl)
return -ENOENT;
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) {
if (ctl->enabled && ctl->dsp->running) if (ctl->enabled && ctl->dsp->running)
return cs_dsp_coeff_read_ctrl_raw(ctl, buf, len); return cs_dsp_coeff_read_ctrl_raw(ctl, buf, len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment