All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
@ 2020-03-23  9:14 Denis Osterland-Heim
  2020-03-23 21:41 ` Jacek Anaszewski
  2020-04-06  5:19 ` Denis Osterland-Heim
  0 siblings, 2 replies; 6+ messages in thread
From: Denis Osterland-Heim @ 2020-03-23  9:14 UTC (permalink / raw)
  To: dmurphy, pavel, jacek.anaszewski; +Cc: Denis Osterland-Heim, linux-leds

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

Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
---
 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.2



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/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
  2020-03-23  9:14 [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add() Denis Osterland-Heim
@ 2020-03-23 21:41 ` Jacek Anaszewski
  2020-03-24  7:36   ` Denis Osterland-Heim
  2020-04-06  5:19 ` Denis Osterland-Heim
  1 sibling, 1 reply; 6+ messages in thread
From: Jacek Anaszewski @ 2020-03-23 21:41 UTC (permalink / raw)
  To: Denis Osterland-Heim, dmurphy, pavel; +Cc: linux-leds

Hi Denis,

Now it is better, it is:
Content-Transfer-Encoding: quoted-printable.

Nonetheless there are still some problems with charset.
See e.g. the line:

"if (ret =3D=3D 0) "

Are you using git send-email for sending patches?
I suspect not since patches arrive unordered by the
position in the patch set.

Best regards,
Jacek Anaszewski


On 3/23/20 10:14 AM, Denis Osterland-Heim wrote:
> led_pwm_set() now returns an error when setting the PWM fails.
> 
> Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
> ---
>  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)
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
  2020-03-23 21:41 ` Jacek Anaszewski
@ 2020-03-24  7:36   ` Denis Osterland-Heim
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Osterland-Heim @ 2020-03-24  7:36 UTC (permalink / raw)
  To: dmurphy, pavel, jacek.anaszewski; +Cc: linux-leds

Hi Jacek,

Am Montag, den 23.03.2020, 22:41 +0100 schrieb Jacek Anaszewski:
> Hi Denis,
> 
> Now it is better, it is:
> Content-Transfer-Encoding: quoted-printable.
> 
> Nonetheless there are still some problems with charset.
> See e.g. the line:
> 
> "if (ret =3D=3D 0) "
I see

> 
> Are you using git send-email for sending patches?
> I suspect not since patches arrive unordered by the
> position in the patch set.
Well, delivery path is:
git send-email
-> local postfix
-> Gnome Evolution
-> MS Exchange server
-> your servers

Normally it works quite well...

Headers after postfix:
Message-Id: <20200323091243.23140-1-Denis.Osterland@diehl.com>
X-Mailer: git-send-email 2.25.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Headers after Evolution:
Message-ID: <20200323091243.23140-1-Denis.Osterland@diehl.com>
X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
MIME-Version: 1.0

Headers after Exchange:
Message-ID: <20200323091243.23140-1-Denis.Osterland@diehl.com>
Accept-Language: de-DE, en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-MS-Exchange-Organization-AuthSource: RCDC-Mail16.corp.diehl.com
X-MS-Has-Attach: 
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator: 
x-mailer: Evolution 3.28.5-0ubuntu0.18.04.1 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

This is also where the transformation from '\x3d' to "=3D" and '\x20' to "=20" happens
and in the original case where the base64 encoding happens.

I can reproduce the problem with the apply of original message now.
At first try I used 'save as mbox' from Evolution UI, which does the conversation
from base64 to normal text. When I copy it local inbox I can use the original version
directly from maildir.

The mail 1/5 and 2/5 also have the conversions from '\x20' to "=20", so Pavel should now
be able to apply the patch. At least I can do so.

I can apply the base64 encode version as well, with:
patch -p1 < .git/rebase-apply/patch
but with warning:
(Stripping trailing CRs from patch; use --binary to disable.)

Regards Denis

> 
> Best regards,
> Jacek Anaszewski
> 


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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
  2020-03-23  9:14 [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add() Denis Osterland-Heim
  2020-03-23 21:41 ` Jacek Anaszewski
@ 2020-04-06  5:19 ` Denis Osterland-Heim
  1 sibling, 0 replies; 6+ messages in thread
From: Denis Osterland-Heim @ 2020-04-06  5:19 UTC (permalink / raw)
  To: pavel; +Cc: dmurphy, linux-leds, jacek.anaszewski

Hi Pavel,

are you willing to give this patch a try in favor of 3/5?
Or shall I resent the fixed series?

Regards Denis

Am Montag, den 23.03.2020, 10:14 +0100 schrieb Denis Osterland-Heim:
> led_pwm_set() now returns an error when setting the PWM fails.
> 
> Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
> ---
>  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)


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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
@ 2020-03-23 15:27 Denis Osterland-Heim
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Osterland-Heim @ 2020-03-23 15:27 UTC (permalink / raw)
  To: linux-leds; +Cc: uwe, Denis Osterland-Heim

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

Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
---
 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.2



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/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()
@ 2020-03-23  6:24 Denis Osterland-Heim
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Osterland-Heim @ 2020-03-23  6:24 UTC (permalink / raw)
  To: linux-kernel

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

Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
---
 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.2



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/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-06  5:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23  9:14 [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add() Denis Osterland-Heim
2020-03-23 21:41 ` Jacek Anaszewski
2020-03-24  7:36   ` Denis Osterland-Heim
2020-04-06  5:19 ` Denis Osterland-Heim
  -- strict thread matches above, loose matches on Subject: below --
2020-03-23 15:27 Denis Osterland-Heim
2020-03-23  6:24 Denis Osterland-Heim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.