2020-03-21 08:16:46

by Denis OSTERLAND-HEIM

[permalink] [raw]
Subject: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

led_pwm_set() now returns an error when setting the PWM fails.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Denis Osterland-Heim <[email protected]>
---
drivers/leds/leds-pwm.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 6caf8bea8cd5..07eab2d8b7c7 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -91,15 +91,21 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
pwm_init_state(led_data->pwm, &led_data->pwmstate);

ret = devm_led_classdev_register(dev, &led_data->cdev);
- if (ret == 0) {
- priv->num_leds++;
- led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
- } else {
+ if (ret) {
dev_err(dev, "failed to register PWM led for %s: %d\n",
led->name, ret);
+ return ret;
}

- return ret;
+ ret = led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
+ if (ret) {
+ dev_err(dev, "failed to set led PWM value for %s: %d",
+ led->name, ret);
+ return ret;
+ }
+
+ priv->num_leds++;
+ return 0;
}

static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
--
2.25.1



Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/


2020-03-21 15:22:24

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

Hi!

> led_pwm_set() now returns an error when setting the PWM fails.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Denis Osterland-Heim <[email protected]>

I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
you see what is going on there?

Best regards,
Pavel

> +++ b/drivers/leds/leds-pwm.c
> @@ -91,15 +91,21 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
> pwm_init_state(led_data->pwm, &led_data->pwmstate);
>
> ret = devm_led_classdev_register(dev, &led_data->cdev);
> - if (ret == 0) {
> - priv->num_leds++;
> - led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> - } else {
> + if (ret) {
> dev_err(dev, "failed to register PWM led for %s: %d\n",
> led->name, ret);
> + return ret;
> }
>
> - return ret;
> + ret = led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> + if (ret) {
> + dev_err(dev, "failed to set led PWM value for %s: %d",
> + led->name, ret);
> + return ret;
> + }
> +
> + priv->num_leds++;
> + return 0;
> }
>
> static int led_pwm_create_fwnode(struct device *dev, struct
> led_pwm_priv *priv)

>
> The contents of the above mentioned e-mail is not legally
> binding. This e-mail contains confidential and/or legally protected
> information. Please inform us if you have received this e-mail by

This is lie. Please don't do this.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.55 kB)
signature.asc (201.00 B)
Download all attachments

2020-03-21 17:15:09

by Denis OSTERLAND-HEIM

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

Hi Pavel,

here it works.

$ git reset --hard origin/for-next
HEAD is now at 032426ff773f leds: lm3532: make bitfield 'enabled' unsigned
$ curl -s https://lore.kernel.org/patchwork/patch/1213548/mbox/ | git am
Applying: leds: pwm: check result of led_pwm_set() in led_pwm_add()

Strange is that the From: tag in 7bbec6c4b51d is not evaluated at your side.
When I do it, I get:

$ git reset --hard 7a6303677598
HEAD is now at 7a6303677598 leds: leds-is31fl32xx: Replace zero-length array with flexible-array member
$ curl -s https://lore.kernel.org/patchwork/patch/1212782/mbox/ | git am
Applying: leds: leds-pwm: Replace zero-length array with flexible-array member
$ git show
commit e247ae982b5ba113cc9668bec578105645137fb2 (HEAD -> for-next)
Author: Gustavo A. R. Silva <[email protected]>
Date: Thu Mar 19 16:51:46 2020 -0500

leds: leds-pwm: Replace zero-length array with flexible-array member

Regards Denis

Am Samstag, den 21.03.2020, 16:20 +0100 schrieb Pavel Machek:
> Hi!
>
> > led_pwm_set() now returns an error when setting the PWM fails.
> >
> > Cc: Uwe Kleine-König <[email protected]>
> > Signed-off-by: Denis Osterland-Heim <[email protected]>
>
> I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
> you see what is going on there?
>
> Best regards,
> Pavel
>
> > +++ b/drivers/leds/leds-pwm.c
> > @@ -91,15 +91,21 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
> > pwm_init_state(led_data->pwm, &led_data->pwmstate);
> >
> > ret = devm_led_classdev_register(dev, &led_data->cdev);
> > - if (ret == 0) {
> > - priv->num_leds++;
> > - led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> > - } else {
> > + if (ret) {
> > dev_err(dev, "failed to register PWM led for %s: %d\n",
> > led->name, ret);
> > + return ret;
> > }
> >
> > - return ret;
> > + ret = led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> > + if (ret) {
> > + dev_err(dev, "failed to set led PWM value for %s: %d",
> > + led->name, ret);
> > + return ret;
> > + }
> > +
> > + priv->num_leds++;
> > + return 0;
> > }
> >
> > static int led_pwm_create_fwnode(struct device *dev, struct
> > led_pwm_priv *priv)
> >
> > The contents of the above mentioned e-mail is not legally
> > binding. This e-mail contains confidential and/or legally protected
> > information. Please inform us if you have received this e-mail by
>
> This is lie. Please don't do this.
> Pavel
> +----------------------------------------------------------------------+
> > Z1 SecureMail Gateway Processing Info |
>
> +----------------------------------------------------------------------+
> > - The message was signed by |
> > [No Info available] |
> > Signature not verifiable |
> > - Message content not verifiable |
> > - Certificate not verifiable |
>
> +----------------------------------------------------------------------+


Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/

2020-03-22 07:52:52

by Denis OSTERLAND-HEIM

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

Hi Pavel,

Am Samstag, den 21.03.2020, 18:13 +0100 schrieb Denis Osterland-Heim:
> Hi Pavel,
>
> here it works.
>
> $ git reset --hard origin/for-next
> HEAD is now at 032426ff773f leds: lm3532: make bitfield 'enabled' unsigned
> $ curl -s https://lore.kernel.org/patchwork/patch/1213548/mbox/ | git am
> Applying: leds: pwm: check result of led_pwm_set() in led_pwm_add()
>
I have applied it to 10a6cce3c1a15e40dd7b69e66e4780476e590f68 without problems as well.

Can you use `git am --show-current-patch | patch -p1 --merge` and post the conflicts?

> Strange is that the From: tag in 7bbec6c4b51d is not evaluated at your side.
> When I do it, I get:
>
> $ git reset --hard 7a6303677598
> HEAD is now at 7a6303677598 leds: leds-is31fl32xx: Replace zero-length array with flexible-array member
> $ curl -s https://lore.kernel.org/patchwork/patch/1212782/mbox/ | git am
> Applying: leds: leds-pwm: Replace zero-length array with flexible-array member
> $ git show
> commit e247ae982b5ba113cc9668bec578105645137fb2 (HEAD -> for-next)
> Author: Gustavo A. R. Silva <[email protected]>
> Date: Thu Mar 19 16:51:46 2020 -0500
>
> leds: leds-pwm: Replace zero-length array with flexible-array member
Sorry for that, this was one patch off.
3953d1908b2cc5f57a5f9ebd7f6b5736a8e1fe25 is the one with the "From:" line.

>
> Regards Denis
>
> Am Samstag, den 21.03.2020, 16:20 +0100 schrieb Pavel Machek:
> > Hi!
> >
...
> > >
> > > The contents of the above mentioned e-mail is not legally
> > > binding. This e-mail contains confidential and/or legally protected
> > > information. Please inform us if you have received this e-mail by
> >
> > This is lie. Please don't do this.
> > Pavel
Corporate Exchange server automatically appends it.
I can not suppress it, sorry.

Regards Denis

> > +----------------------------------------------------------------------+
> > > Z1 SecureMail Gateway Processing Info |
> >
> > +----------------------------------------------------------------------+
> > > - The message was signed by |
> > > [No Info available] |
> > > Signature not verifiable |
> > > - Message content not verifiable |
> > > - Certificate not verifiable |
> >
> > +----------------------------------------------------------------------+


Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/

2020-03-22 14:58:32

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

On 3/21/20 4:20 PM, Pavel Machek wrote:
> Hi!
>
>> led_pwm_set() now returns an error when setting the PWM fails.
>>
>> Cc: Uwe Kleine-K?nig <[email protected]>
>> Signed-off-by: Denis Osterland-Heim <[email protected]>
>
> I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
> you see what is going on there?

Check the contents of the patch after writing it on a disk.
In my case it contains a block of random characters.
It is probably due to Content-Transfer-Encoding: base64.

--
Best regards,
Jacek Anaszewski

2020-03-23 06:09:41

by Denis OSTERLAND-HEIM

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

Hi,

Am Sonntag, den 22.03.2020, 15:56 +0100 schrieb Jacek Anaszewski:
> On 3/21/20 4:20 PM, Pavel Machek wrote:
> > Hi!
> >
> > > led_pwm_set() now returns an error when setting the PWM fails.
> > >
> > > Cc: Uwe Kleine-König <[email protected]>
> > > Signed-off-by: Denis Osterland-Heim <[email protected]>
> >
> > I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
> > you see what is going on there?
>
> Check the contents of the patch after writing it on a disk.
> In my case it contains a block of random characters.
> It is probably due to Content-Transfer-Encoding: base64.
>
strange.
In the version I received by CC, there is no garbage, but also no auto appended footer.

I will send the mail just to linux-leds so we should all receive the same mail.

I wonder if the 'ö' in König causes this trouble in my send path.

Regards Denis


Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/

2020-03-23 09:10:50

by Denis OSTERLAND-HEIM

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()

Hi again,

Am Montag, den 23.03.2020, 07:09 +0100 schrieb Denis Osterland-Heim:
> Hi,
>
> Am Sonntag, den 22.03.2020, 15:56 +0100 schrieb Jacek Anaszewski:
> > On 3/21/20 4:20 PM, Pavel Machek wrote:
> > > Hi!
> > >
> > > > led_pwm_set() now returns an error when setting the PWM fails.
> > > >
> > > > Cc: Uwe Kleine-König <[email protected]>
> > > > Signed-off-by: Denis Osterland-Heim <[email protected]>
> > >
> > > I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
> > > you see what is going on there?
> >
> > Check the contents of the patch after writing it on a disk.
> > In my case it contains a block of random characters.
> > It is probably due to Content-Transfer-Encoding: base64.
> >
>
> strange.
> In the version I received by CC, there is no garbage, but also no auto appended footer.
>
> I will send the mail just to linux-leds so we should all receive the same mail.
I received no mail :/ and when I look at https://patches.linaro.org/project/linux-leds/list/
I would expect that you received nothing, too.

>
> I wonder if the 'ö' in König causes this trouble in my send path.
I will send the patch without the Cc line, maybe this fixes the problem at your side.

Regards Denis

>
> Regards Denis


Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/