Extcon: Arizona: unlock on an error in arizona_micdet()
Subsystems (2)
PATCH 1/1 Extcon: Arizona: unlock on an error in arizona_micdet()
Smatch complains about this. I don't have a way to test this, but it does look like we should unlock on error here.
drivers/extcon/extcon-arizona.c +1 -0
@@ -154,6 +154,7 @@ static irqreturn_t arizona_micdet(int irq, void *data) ret =regmap_read (arizona->regmap,ARIZONA_MIC_DETECT_3 , &val);if (ret !=0 ) {dev_err (arizona->dev,"Failed to read MICDET: %d\n" , ret); +mutex_unlock (&info->lock);return IRQ_NONE ; }
Chanwoo Choi
maintainerHi Dan,
Quoted 10 lines · Dan Carpenter
Smatch complains about this. I don't have a way to test this, but it does look like we should unlock on error here.
Signed-off-by Dan Carpenter <[email protected]>drivers/extcon/extcon-arizona.c +0
-0
drivers/extcon/extcon-arizona.c static irqreturn_t arizona_micdet(int irq, void *data) · line 160
Quoted 7 lines
drivers/extcon/extcon-arizona.c +1
-0@@ -154,6 +154,7 @@ static irqreturn_t arizona_micdet(int irq, void *data) ret =regmap_read (arizona->regmap,ARIZONA_MIC_DETECT_3 , &val);if (ret !=0 ) {dev_err (arizona->dev,"Failed to read MICDET: %d\n" , ret); +mutex_unlock (&info->lock);return IRQ_NONE ; }
This patch is right.
Am 11.07.2012 08:36, schrieb Dan Carpenter:
Quoted 10 lines
Smatch complains about this. I don't have a way to test this, but it does look like we should unlock on error here.
Signed-off-by Dan Carpenter <[email protected]>drivers/extcon/extcon-arizona.c +0
-0
drivers/extcon/extcon-arizona.c static irqreturn_t arizona_micdet(int irq, void *data)
Quoted 8 lines
drivers/extcon/extcon-arizona.c +1
-1@@ -154,6 +154,7 @@ static irqreturn_t arizona_micdet(int irq, void *data) ret =regmap_read (arizona->regmap,ARIZONA_MIC_DETECT_3 , &val);if (ret !=0 ) {dev_err (arizona->dev,"Failed to read MICDET: %d\n" , ret); +mutex_unlock (&info->lock);return IRQ_NONE ; } --
nitpicking:
normally you unlock before dev_err() and is the msg ok ? IMHO "Failed to read ARIZONA_MIC_DETECT_3:%d\n" seems more obvious, (I really do not know that device)
re,
wh
Quoted 5 lines · walter harms
nitpicking:
normally you unlock beforedev_err()and is the msg ok ? IMHO "Failed to read ARIZONA_MIC_DETECT_3:%d\n" seems more obvious, (I really do not know that device)
It's not a bad idea if someone wants to send a follow on patch. I just matched the rest of the function.
regards,
dan carpenter
Quoted 6 lines · walter harms
drivers/extcon/extcon-arizona.c static irqreturn_t arizona_micdet(int irq, void *data) · line 158
Quoted 4 lines
drivers/extcon/extcon-arizona.c +1
-0if (ret !=0 ) {dev_err (arizona->dev,"Failed to read MICDET: %d\n" , ret); +mutex_unlock (&info->lock);return IRQ_NONE ;normally you unlock before
dev_err()and is the msg ok ?
No, that's really unusual as it can make the trace much harder to follow if there's any contention.
Quoted 4 lines · Dan Carpenter
Smatch complains about this. I don't have a way to test this, but it does look like we should unlock on error here.
Signed-off-by Dan Carpenter <[email protected]>
Acke-dby: Mark Brown <[email protected]>