summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2015-12-15 21:03:51 +0100
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-01-04 09:57:40 +0100
commit143b77ce03b44779987109486212838df2f03cae (patch)
treef0ef47bbeaece8b0e06a377e73d29f636f0a331e /drivers/leds
parent4ba113b6d4a4cec461e373aca44ce6bb2cb02476 (diff)
downloadtalos-obmc-linux-143b77ce03b44779987109486212838df2f03cae.tar.gz
talos-obmc-linux-143b77ce03b44779987109486212838df2f03cae.zip
leds: bcm6328: simplify duplicated unlock in bcm6328_blink_set
Instead of duplicating the unlock we can store the return value and use a single unlock before returning that value, which simplifies the code. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-bcm6328.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index e13daa2f31fb..47f7c9f310be 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -146,6 +146,7 @@ static int bcm6328_blink_set(struct led_classdev *led_cdev,
struct bcm6328_led *led =
container_of(led_cdev, struct bcm6328_led, cdev);
unsigned long delay, flags;
+ int rc;
if (!*delay_on)
*delay_on = BCM6328_LED_DEF_DELAY;
@@ -183,16 +184,15 @@ static int bcm6328_blink_set(struct led_classdev *led_cdev,
bcm6328_led_write(led->mem + BCM6328_REG_INIT, val);
bcm6328_led_mode(led, BCM6328_LED_MODE_BLINK);
-
- spin_unlock_irqrestore(led->lock, flags);
+ rc = 0;
} else {
- spin_unlock_irqrestore(led->lock, flags);
dev_dbg(led_cdev->dev,
"fallback to soft blinking (delay already set)\n");
- return -EINVAL;
+ rc = -EINVAL;
}
+ spin_unlock_irqrestore(led->lock, flags);
- return 0;
+ return rc;
}
static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
OpenPOWER on IntegriCloud