Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733592

[PATCH for 4.9 36/39] ASoC: wm_adsp: Return an error on write to a disabled volatile control

From "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Newsgroups linux.kernel
Subject [PATCH for 4.9 36/39] ASoC: wm_adsp: Return an error on write to a disabled volatile control
Date 2017-09-18 02:50 +0200
Message-ID <uqSq8-72l-51@gated-at.bofh.it> (permalink)
References <uqSq5-72l-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

[ Upstream commit 67430a39ca7a6af28aade5acb92d43ee257c1014 ]

Volatile controls should only be accessed when the firmware is active,
currently however writes to these controls will succeed, but the data
will be lost, if the firmware is powered down. Update this behaviour such
that an error is returned the same as it is for reads.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 sound/soc/codecs/wm_adsp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b943dde8dbe5..3bdd81930486 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -789,7 +789,10 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,
 
 	mutex_lock(&ctl->dsp->pwr_lock);
 
-	memcpy(ctl->cache, p, ctl->len);
+	if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
+		ret = -EPERM;
+	else
+		memcpy(ctl->cache, p, ctl->len);
 
 	ctl->set = 1;
 	if (ctl->enabled && ctl->dsp->running)
@@ -816,6 +819,8 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
 		ctl->set = 1;
 		if (ctl->enabled && ctl->dsp->running)
 			ret = wm_coeff_write_control(ctl, ctl->cache, size);
+		else if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
+			ret = -EPERM;
 	}
 
 	mutex_unlock(&ctl->dsp->pwr_lock);
-- 
2.11.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH for 4.9 18/39] iommu/exynos: Block SYSMMU while invalidating  FLPD cache "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 27/39] x86/acpi: Restore the order of CPU IDs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 22/39] netfilter: nfnl_cthelper: fix incorrect  helper->expect_class_max "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 35/39] xfs: remove kmem_zalloc_greedy "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 31/39] rds: ib: add error handle "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 24/39] nfs: make nfs4_cb_sv_ops static "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 32/39] md/raid10: submit bio directly to replacement  disk "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 38/39] ARM: dts: BCM5301X: Fix memory start address "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 29/39] arm64: kasan: avoid bad virt_to_pfn() "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 39/39] tools/power turbostat: bugfix: GFXMHz column  not changing "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 20/39] MIPS: smp-cps: Fix retrieval of VPE mask on big  endian CPUs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 28/39] iommu/io-pgtable-arm: Check for leaf entry  before dereferencing it "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 23/39] parisc: perf: Fix potential NULL pointer  dereference "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 34/39] i2c: meson: fix wrong variable usage in  meson_i2c_put_data "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 36/39] ASoC: wm_adsp: Return an error on write to a  disabled volatile control "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 25/39] ibmvnic: Free tx/rx scrq pointer array when  releasing sub-crqs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 33/39] netfilter: nf_tables: set pktinfo->thoff at AH  header if found "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 37/39] libata: transport: Remove circular dependency  at free time "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200

csiph-web