counter: rz-mtu3-cnt: Unlock on error in rz_mtu3_count_ceiling_write()
Subsystems (4)
PATCH v2 1/1 counter: rz-mtu3-cnt: Unlock on error in rz_mtu3_count_ceiling_write()
These error paths need to call mutex_unlock(&priv->lock) before returning. The lock is taken in rz_mtu3_lock_if_counter_is_valid().
---
v2: I had the wrong function in the subject. Also style changes.
drivers/counter/rz-mtu3-cnt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/counter/rz-mtu3-cnt.c +6 -2
@@ -358,13 +358,17 @@ static int rz_mtu3_count_ceiling_write(struct counter_device *counter,switch (count->id) {case RZ_MTU3_16_BIT_MTU1_CH :case RZ_MTU3_16_BIT_MTU2_CH : -if (ceiling >U16_MAX ) +if (ceiling >U16_MAX ) { +mutex_unlock (&priv->lock);return -ERANGE ; + } priv->mtu_16bit_max[ch_id] = ceiling;break ;case RZ_MTU3_32_BIT_CH : -if (ceiling >U32_MAX ) +if (ceiling >U32_MAX ) { +mutex_unlock (&priv->lock);return -ERANGE ; + } priv->mtu_32bit_max = ceiling;break ;default :
Signature · 1 line
2.39.2
Quoted 5 lines · Dan Carpenter
These error paths need to call
mutex_unlock(&priv->lock)before returning. The lock is taken inrz_mtu3_lock_if_counter_is_valid().Fixes 25d21447d896 ("counter: Add Renesas RZ/G2L MTU3a counter driver")Signed-off-by Dan Carpenter <[email protected]>
Despite this being a fix, I think this driver currently is only in the mfd tree, right? So I assume Lee Jones will pick this up for there.
Thanks,
William Breathitt Gray
Quoted 33 lines
---
v2: I had the wrong function in the subject. Also style changes.drivers/counter/rz-mtu3-cnt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/counter/rz-mtu3-cnt.c +6
-2@@ -358,13 +358,17 @@ static int rz_mtu3_count_ceiling_write(struct counter_device *counter,switch (count->id) {case RZ_MTU3_16_BIT_MTU1_CH :case RZ_MTU3_16_BIT_MTU2_CH : -if (ceiling >U16_MAX ) +if (ceiling >U16_MAX ) { +mutex_unlock (&priv->lock);return -ERANGE ; + } priv->mtu_16bit_max[ch_id] = ceiling;break ;case RZ_MTU3_32_BIT_CH : -if (ceiling >U32_MAX ) +if (ceiling >U32_MAX ) { +mutex_unlock (&priv->lock);return -ERANGE ; + } priv->mtu_32bit_max = ceiling;break ;default :Signature · 1 line
2.39.2
Lee Jones
AppliedQuoted 10 lines · Dan Carpenter
These error paths need to call
mutex_unlock(&priv->lock)before returning. The lock is taken inrz_mtu3_lock_if_counter_is_valid().Fixes 25d21447d896 ("counter: Add Renesas RZ/G2L MTU3a counter driver")Signed-off-by Dan Carpenter <[email protected]>---
v2: I had the wrong function in the subject. Also style changes.drivers/counter/rz-mtu3-cnt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Applied, thanks
Signature · 1 line
Lee Jones [李琼斯]