Skip to contentSkip to conversation

rc: unlock on error in show_protocols()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 27, 2012

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

PATCH 1/2 rc: unlock on error in show_protocols()

We recently introduced a new return -ENODEV in this function but we need to unlock before returning.

drivers/media/rc/rc-main.c +3 -1
index 601d1ac1..d593bc6 100644
@@ -789,8 +789,10 @@ static ssize_t show_protocols(struct device *device,
 	} else if (dev->raw) {
 		enabled = dev->raw->enabled_protocols;
 		allowed = ir_raw_get_allowed_protocols();
-	} else
+	} else {
+		mutex_unlock(&dev->lock);
 		return -ENODEV;
+	}
 
 	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
 		   (long long)allowed,
#1 lore raw
Quoted 2 lines · Dan Carpenter

We recently introduced a new return -ENODEV in this function but we need to unlock before returning.

There is an identical patch here (scroll down):
https://patchwork.kernel.org/patch/1284081/

I'm not sure what happened to it.

Douglas

Quoted 19 lines
drivers/media/rc/rc-main.c +3 -1
index 601d1ac1..d593bc6 100644
@@ -789,8 +789,10 @@ static ssize_t show_protocols(struct device *device,
 	} else if (dev->raw) {
 		enabled = dev->raw->enabled_protocols;
 		allowed = ir_raw_get_allowed_protocols();
-	} else
+	} else {
+		mutex_unlock(&dev->lock);
 		return -ENODEV;
+	}
 
 	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
 		   (long long)allowed,