From: Dan Carpenter Date: Thu, 26 May 2011 08:52:01 +0000 (-0300) Subject: [media] rc: double unlock in rc_register_device() X-Git-Tag: MMI-PSA29.97-13-9~18729^2~399 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0528f354cfb98d8df32a76302ec07af1aa29dbd4;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [media] rc: double unlock in rc_register_device() If change_protocol() fails and we goto out_raw, then it calls unlock twice. I noticed that the other time we called change_protocol() we held the &dev->lock, so I changed it to hold it here too. Reviewed-by: Jarod Wilson Acked-by: Jarod Wilson Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 3186ac7c2c10..30634ab5c226 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1099,7 +1099,6 @@ int rc_register_device(struct rc_dev *dev) if (rc < 0) goto out_input; } - mutex_unlock(&dev->lock); if (dev->change_protocol) { rc = dev->change_protocol(dev, rc_map->rc_type); @@ -1107,6 +1106,8 @@ int rc_register_device(struct rc_dev *dev) goto out_raw; } + mutex_unlock(&dev->lock); + IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n", dev->devno, dev->driver_name ? dev->driver_name : "unknown",