summaryrefslogtreecommitdiff
path: root/drivers/counter
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/counter')
-rw-r--r--drivers/counter/rz-mtu3-cnt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c
index a371bab68499..48c83933aa2f 100644
--- a/drivers/counter/rz-mtu3-cnt.c
+++ b/drivers/counter/rz-mtu3-cnt.c
@@ -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: