summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2021-11-17 13:22:57 +0000
committerMark Brown <broonie@kernel.org>2021-11-17 22:16:25 +0000
commit86c6080407740937ed2ba0ccd181e947f77e2154 (patch)
tree380b99c75928041a83a5fea186838acf473dff9a /drivers/firmware
parentdcee767667f44ed0d40a3debf507a3ba027a1994 (diff)
downloadlinux-stable-86c6080407740937ed2ba0ccd181e947f77e2154.tar.gz
linux-stable-86c6080407740937ed2ba0ccd181e947f77e2154.tar.bz2
linux-stable-86c6080407740937ed2ba0ccd181e947f77e2154.zip
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: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-7-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/cirrus/cs_dsp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 62ba4ebbf11f..9eecd1626537 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -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);
+ if (!ctl)
+ return -ENOENT;
+
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
ret = -EPERM;
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)
lockdep_assert_held(&ctl->dsp->pwr_lock);
+ if (!ctl)
+ return -ENOENT;
+
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) {
if (ctl->enabled && ctl->dsp->running)
return cs_dsp_coeff_read_ctrl_raw(ctl, buf, len);