From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/6] leds: gpio: fix an unhandled error case in create_gpio_led
Date: Thu, 15 Sep 2016 13:48:08 +0200 [thread overview]
Message-ID: <75b174d3-14cc-15c9-ab01-b2e2faa296de@samsung.com> (raw)
In-Reply-To: <15945af0-24df-ff7c-73b7-7872dc5ed8bd@gmail.com>
Hi Heiner,
On 09/13/2016 08:53 PM, Heiner Kallweit wrote:
> gpiod_get_value_cansleep returns 0, 1, or an error code.
> So far errors are not handled and treated the same as 1.
> Change this to bail out if an error code is returned and
> remove the double negation.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/leds/leds-gpio.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 3599b2e..10c851e 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -118,10 +118,13 @@ static int create_gpio_led(const struct gpio_led *template,
> led_dat->platform_gpio_blink_set = blink_set;
> led_dat->cdev.blink_set = gpio_blink_set;
> }
> - if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP)
> - state = !!gpiod_get_value_cansleep(led_dat->gpiod);
> - else
> + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) {
> + state = gpiod_get_value_cansleep(led_dat->gpiod);
> + if (state < 0)
> + return state;
> + } else {
> state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
> + }
> led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
> if (!template->retain_state_suspended)
> led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>
Thanks for the updated patch set. Applied.
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2016-09-15 11:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5432fb03-ea18-a949-ce53-10fedc15f5d9@gmail.com>
2016-09-13 18:53 ` Heiner Kallweit
2016-09-14 7:13 ` Jacek Anaszewski
2016-09-15 11:48 ` Jacek Anaszewski [this message]
2016-09-13 18:54 ` [PATCH 2/6] leds: gpio: add helper cdev_to_gpio_led_data Heiner Kallweit
2016-09-13 18:55 ` [PATCH 3/6] leds: gpio: simplify gpio_leds_create Heiner Kallweit
2016-09-13 18:56 ` [PATCH 4/6] leds: gpio: fix and simplify reading property "label" Heiner Kallweit
2016-09-13 18:57 ` [PATCH 5/6] leds: gpio: switch to managed version of led_classdev_register Heiner Kallweit
2016-09-13 18:57 ` [PATCH 6/6] leds: gpio: fix and simplify error handling in gpio_leds_create Heiner Kallweit
2016-09-14 18:54 ` [PATCH v2 2/7] leds: gpio: fix an unhandled error case in create_gpio_led Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 3/7] leds: gpio: add helper cdev_to_gpio_led_data Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 4/7] leds: gpio: simplify gpio_leds_create Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 5/7] leds: gpio: fix and simplify reading property "label" Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 6/7] leds: gpio: switch to managed version of led_classdev_register Heiner Kallweit
2016-09-14 18:55 ` [PATCH v2 7/7] leds: gpio: fix and simplify error handling in gpio_leds_create Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75b174d3-14cc-15c9-ab01-b2e2faa296de@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®