diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2015-12-15 20:03:51 (GMT) |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-01-04 08:57:40 (GMT) |
commit | 143b77ce03b44779987109486212838df2f03cae (patch) | |
tree | f0ef47bbeaece8b0e06a377e73d29f636f0a331e /drivers/leds/leds-bcm6328.c | |
parent | 4ba113b6d4a4cec461e373aca44ce6bb2cb02476 (diff) | |
download | linux-143b77ce03b44779987109486212838df2f03cae.tar.xz |
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/leds-bcm6328.c')
-rw-r--r-- | drivers/leds/leds-bcm6328.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index e13daa2..47f7c9f 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, |