ASoC: ops: Fix off by one in range control validation
Sasha Levin
maintainerPATCH 1/10 ASoC: ops: Fix off by one in range control validation
From: Mark Brown <[email protected]>
[ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ]
We currently report that range controls accept a range of 0..(max-min) but accept writes in the range 0..(max-min+1). Remove that extra +1.
--- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-ops.c +2 -2
@@ -530,7 +530,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,return -EINVAL ;if (mc->platform_max && tmp > mc->platform_max)return -EINVAL ; -if (tmp > mc->max - mc->min +1 ) +if (tmp > mc->max - mc->min)return -EINVAL ;if (invert)
@@ -551,7 +551,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,return -EINVAL ;if (mc->platform_max && tmp > mc->platform_max)return -EINVAL ; -if (tmp > mc->max - mc->min +1 ) +if (tmp > mc->max - mc->min)return -EINVAL ;if (invert)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/10 ASoC: wm5110: Fix DRE control
From: Charles Keepax <[email protected]>
[ Upstream commit 0bc0ae9a5938d512fd5d44f11c9c04892dcf4961 ]
The DRE controls on wm5110 should return a value of 1 if the DRE state is actually changed, update to fix this.
--- sound/soc/codecs/wm5110.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/wm5110.c +6 -2
@@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,unsigned int rnew = (!!ucontrol->value.integer.value[1 ]) << mc->rshift;unsigned int lold, rold;unsigned int lena, rena; +bool change = false;int ret;snd_soc_dapm_mutex_lock (dapm);
@@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, goto err; } - ret =regmap_update_bits (arizona->regmap,ARIZONA_DRE_ENABLE , - mask, lnew | rnew); + ret =regmap_update_bits_check (arizona->regmap,ARIZONA_DRE_ENABLE , + mask, lnew | rnew, &change);if (ret) {dev_err (arizona->dev,"Failed to set DRE: %d\n" , ret); goto err;
@@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,if (!rnew && rold)wm5110_clear_pga_volume (arizona, mc->rshift); +if (change) + ret =1 ; + err:snd_soc_dapm_mutex_unlock (dapm);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/10 ASoC: cs47l15: Fix event generation for low power mux control
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 7f103af4a10f375b9b346b4d0b730f6a66b8c451 ]
cs47l15_in1_adc_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed.
--- sound/soc/codecs/cs47l15.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/cs47l15.c +4 -1
@@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,snd_soc_kcontrol_component (kcontrol);struct cs47l15 *cs47l15 =snd_soc_component_get_drvdata (component); +if (!!ucontrol->value.integer.value[0 ] == cs47l15->in1_lp_mode) +return 0 ; +switch (ucontrol->value.integer.value[0 ]) {case 0 :/* Set IN1 to normal mode */
@@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,break ; } -return 0 ; +return 1 ; }static const struct snd_kcontrol_new cs47l15_snd_controls[] = {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/10 ASoC: madera: Fix event generation for OUT1 demux
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit e3cabbef3db8269207a6b8808f510137669f8deb ]
madera_out1_demux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed.
--- sound/soc/codecs/madera.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/madera.c +7 -1
@@ -568,7 +568,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontrol, end:snd_soc_dapm_mutex_unlock (dapm); -return snd_soc_dapm_mux_update_power (dapm, kcontrol, mux, e,NULL ); + ret =snd_soc_dapm_mux_update_power (dapm, kcontrol, mux, e,NULL ); +if (ret <0 ) { +dev_err (madera->dev,"Failed to update demux power state: %d\n" , ret); +return ret; + } + +return change; }EXPORT_SYMBOL_GPL (madera_out1_demux_put);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/10 ASoC: madera: Fix event generation for rate controls
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 980555e95f7cabdc9c80a07107622b097ba23703 ]
madera_adsp_rate_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed.
--- sound/soc/codecs/madera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/madera.c +3 -3
@@ -853,7 +853,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;const int adsp_num = e->shift_l;const unsigned int item = ucontrol->value.enumerated.item[0 ]; -int ret; +int ret =0 ;if (item >= e->items)return -EINVAL ;
@@ -870,10 +870,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,"Cannot change '%s' while in use by active audio paths\n" , kcontrol->id.name); ret = -EBUSY ; - }else { + }else if (priv->adsp_rate_cache[adsp_num] != e->values[item]) {/* Volatile register so defer until the codec is powered up */ priv->adsp_rate_cache[adsp_num] = e->values[item]; - ret =0 ; + ret =1 ; }mutex_unlock (&priv->rate_lock);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/10 irqchip: or1k-pic: Undefine mask_ack for level triggered hardware
In reply to Sasha LevinFrom: Stafford Horne <[email protected]>
[ Upstream commit 8520501346ed8d1c4a6dfa751cb57328a9c843f1 ]
The mask_ack operation clears the interrupt by writing to the PICSR register. This we don't want for level triggered interrupt because it does not actually clear the interrupt on the source hardware.
This was causing issues in qemu with multi core setups where interrupts would continue to fire even though they had been cleared in PICSR.
Just remove the mask_ack operation.
--- drivers/irqchip/irq-or1k-pic.c | 1 - 1 file changed, 1 deletion(-)
drivers/irqchip/irq-or1k-pic.c +0 -1
@@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level = { .name = "or1k-PIC-level", .irq_unmask = or1k_pic_unmask, .irq_mask = or1k_pic_mask, - .irq_mask_ack = or1k_pic_mask_ack, }, .handle = handle_level_irq, .flags = IRQ_LEVEL | IRQ_NOPROBE,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/10 x86: Clear .brk area at early boot
In reply to Sasha LevinFrom: Juergen Gross <[email protected]>
[ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ]
The .brk section has the same properties as .bss: it is an alloc-only section and should be cleared before being used.
Not doing so is especially a problem for Xen PV guests, as the hypervisor will validate page tables (check for writable page tables and hypervisor private bits) before accepting them to be used.
Make sure .brk is initially zero by letting clear_bss() clear the brk area, too.
--- arch/x86/kernel/head64.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/head64.c +2 -0
@@ -383,6 +383,8 @@ static void __init clear_bss(void) {memset (__bss_start,0 , (unsigned long ) __bss_stop - (unsigned long ) __bss_start); +memset (__brk_base,0 , + (unsigned long ) __brk_limit - (unsigned long ) __brk_base); }static unsigned long get_cmd_line_ptr (void )
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/10 soc: ixp4xx/npe: Fix unused match warning
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit 620f83b8326ce9706b1118334f0257ae028ce045 ]
The kernel test robot found this inconsistency:
drivers/soc/ixp4xx/ixp4xx-npe.c:737:34: warning:
'ixp4xx_npe_of_match' defined but not used [-Wunused-const-variable=]
737 | static const struct of_device_id ixp4xx_npe_of_match[] = {This is because the match is enclosed in the of_match_ptr() which compiles into NULL when OF is disabled and this is unnecessary.
Fix it by dropping of_match_ptr() around the match.
--- drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/ixp4xx/ixp4xx-npe.c +1 -1
@@ -735,7 +735,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = {static struct platform_driver ixp4xx_npe_driver = { .driver = { .name ="ixp4xx-npe" , - .of_match_table =of_match_ptr (ixp4xx_npe_of_match), + .of_match_table = ixp4xx_npe_of_match, }, .probe = ixp4xx_npe_probe, .remove = ixp4xx_npe_remove,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/10 ARM: dts: stm32: use the correct clock source for CEC on stm32mp151
In reply to Sasha LevinFrom: Gabriel Fernandez <[email protected]>
[ Upstream commit 78ece8cce1ba0c3f3e5a7c6c1b914b3794f04c44 ]
The peripheral clock of CEC is not LSE but CEC.
--- arch/arm/boot/dts/stm32mp157c.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp157c.dtsi +1 -1
@@ -515,7 +515,7 @@ cec: cec@40016000 { compatible = "st,stm32-cec"; reg = <0x40016000 0x400>; interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&rcc CEC_K>, <&clk_lse>; + clocks = <&rcc CEC_K>, <&rcc CEC>; clock-names = "cec", "hdmi-cec"; status = "disabled"; };
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 10/10 signal handling: don't use BUG_ON() for debugging
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ]
These are indeed "should not happen" situations, but it turns out recent changes made the 'task_is_stopped_or_trace()' case trigger (fix for that exists, is pending more testing), and the BUG_ON() makes it unnecessarily hard to actually debug for no good reason.
It's been that way for a long time, but let's make it clear: BUG_ON() is not good for debugging, and should never be used in situations where you could just say "this shouldn't happen, but we can continue".
Use WARN_ON_ONCE() instead to make sure it gets logged, and then just continue running. Instead of making the system basically unusuable because you crashed the machine while potentially holding some very core locks (eg this function is commonly called while holding 'tasklist_lock' for writing).
--- kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/signal.c +4 -4
@@ -1916,12 +1916,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig)bool autoreap = false;u64 utime, stime; -BUG_ON (sig ==-1 ); +WARN_ON_ONCE (sig ==-1 ); -/* do_notify_parent_cldstop should have been called instead. */ -BUG_ON (task_is_stopped_or_traced (tsk)); +/* do_notify_parent_cldstop should have been called instead. */ +WARN_ON_ONCE (task_is_stopped_or_traced (tsk)); -BUG_ON (!tsk->ptrace && +WARN_ON_ONCE (!tsk->ptrace && (tsk->group_leader != tsk || !thread_group_empty (tsk)));/* Wake up all pidfd waiters */
Signature · 1 line
2.35.1