Skip to contentSkip to conversation

Extcon: Arizona: unlock on an error in arizona_micdet()

PATCH In review Dan Carpenter 4 participants 6 messages Jul 11, 2012 – Jul 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index b068bc9..4782884 100644
@@ -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;
 	}
 
maintainer
#1 lore raw

Hi 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.

drivers/extcon/extcon-arizona.c +0 -0
index b068bc9..4782884 100644

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.

#2 lore raw
In reply to Dan Carpenter

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.

drivers/extcon/extcon-arizona.c +0 -0
index b068bc9..4782884 100644

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

#3 lore raw
In reply to Dan Carpenter
Quoted 5 lines · walter harms

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)

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

#4 lore raw
In reply to 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 -0
 	if (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.