All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
@ 2021-06-21 13:04 ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 13:04 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-arm-kernel, linux-pwm, kernel

vt8500_pwm_remove() is only called after vt8500_pwm_probe() returned
successfully. In this case driver data was set to a non-NULL value
and so chip can never be NULL.

While touching this code also put declaration and assignment in a single
line.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-vt8500.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index f9eb36be9088..7164df2fbacf 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -238,11 +238,8 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 
 static int vt8500_pwm_remove(struct platform_device *pdev)
 {
-	struct vt8500_chip *chip;
+	struct vt8500_chip *chip = platform_get_drvdata(pdev);
 
-	chip = platform_get_drvdata(pdev);
-	if (chip == NULL)
-		return -ENODEV;
 
 	clk_unprepare(chip->clk);
 
-- 
2.30.2


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

* [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
@ 2021-06-21 13:04 ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 13:04 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-arm-kernel, linux-pwm, kernel

vt8500_pwm_remove() is only called after vt8500_pwm_probe() returned
successfully. In this case driver data was set to a non-NULL value
and so chip can never be NULL.

While touching this code also put declaration and assignment in a single
line.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-vt8500.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index f9eb36be9088..7164df2fbacf 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -238,11 +238,8 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 
 static int vt8500_pwm_remove(struct platform_device *pdev)
 {
-	struct vt8500_chip *chip;
+	struct vt8500_chip *chip = platform_get_drvdata(pdev);
 
-	chip = platform_get_drvdata(pdev);
-	if (chip == NULL)
-		return -ENODEV;
 
 	clk_unprepare(chip->clk);
 
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] pwm: vt8500: Only unprepare the clock after the pwmchip was removed
  2021-06-21 13:04 ` Uwe Kleine-König
@ 2021-06-21 13:04   ` Uwe Kleine-König
  -1 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 13:04 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-arm-kernel, linux-pwm, kernel

Until pwmchip_remove() returns the PWM is supposed to work, so
pwmchip_remove() must be called before the clock is stopped.

The return value of pwmchip_remove doesn't need to be checked because
it returns zero anyhow and I plan to make it return void soon.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-vt8500.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index 7164df2fbacf..ea2aa151080a 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -240,10 +240,11 @@ static int vt8500_pwm_remove(struct platform_device *pdev)
 {
 	struct vt8500_chip *chip = platform_get_drvdata(pdev);
 
+	pwmchip_remove(&chip->chip);
 
 	clk_unprepare(chip->clk);
 
-	return pwmchip_remove(&chip->chip);
+	return 0;
 }
 
 static struct platform_driver vt8500_pwm_driver = {
-- 
2.30.2


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

* [PATCH 2/2] pwm: vt8500: Only unprepare the clock after the pwmchip was removed
@ 2021-06-21 13:04   ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 13:04 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-arm-kernel, linux-pwm, kernel

Until pwmchip_remove() returns the PWM is supposed to work, so
pwmchip_remove() must be called before the clock is stopped.

The return value of pwmchip_remove doesn't need to be checked because
it returns zero anyhow and I plan to make it return void soon.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-vt8500.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index 7164df2fbacf..ea2aa151080a 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -240,10 +240,11 @@ static int vt8500_pwm_remove(struct platform_device *pdev)
 {
 	struct vt8500_chip *chip = platform_get_drvdata(pdev);
 
+	pwmchip_remove(&chip->chip);
 
 	clk_unprepare(chip->clk);
 
-	return pwmchip_remove(&chip->chip);
+	return 0;
 }
 
 static struct platform_driver vt8500_pwm_driver = {
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
  2021-06-21 13:04 ` Uwe Kleine-König
@ 2021-06-21 16:40   ` Uwe Kleine-König
  -1 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 16:40 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-pwm, kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

Hello,

for the record: There is no need to wait for a reply by Tony Prisk, his
address created a bounce (SMTP error from remote mail server after RCPT
TO:<linux@prisktech.co.nz>: 550 relay not permitted)

Checking my archives I alread got such a result back in March, so this
doesn't seem to be a temporal problem.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
@ 2021-06-21 16:40   ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 16:40 UTC (permalink / raw)
  To: Tony Prisk, Thierry Reding, Lee Jones; +Cc: linux-pwm, kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 504 bytes --]

Hello,

for the record: There is no need to wait for a reply by Tony Prisk, his
address created a bounce (SMTP error from remote mail server after RCPT
TO:<linux@prisktech.co.nz>: 550 relay not permitted)

Checking my archives I alread got such a result back in March, so this
doesn't seem to be a temporal problem.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
  2021-06-21 13:04 ` Uwe Kleine-König
@ 2021-06-22  7:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2021-06-22  7:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Linux ARM, Linux PWM List, Sascha Hauer

On Mon, Jun 21, 2021 at 3:04 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> vt8500_pwm_remove() is only called after vt8500_pwm_probe() returned
> successfully. In this case driver data was set to a non-NULL value
> and so chip can never be NULL.
>
> While touching this code also put declaration and assignment in a single
> line.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Both patches

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition
@ 2021-06-22  7:41   ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2021-06-22  7:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Linux ARM, Linux PWM List, Sascha Hauer

On Mon, Jun 21, 2021 at 3:04 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> vt8500_pwm_remove() is only called after vt8500_pwm_probe() returned
> successfully. In this case driver data was set to a non-NULL value
> and so chip can never be NULL.
>
> While touching this code also put declaration and assignment in a single
> line.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Both patches

Acked-by: Arnd Bergmann <arnd@arndb.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-22  7:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 13:04 [PATCH 1/2] pwm: vt8500: Drop if with an always false condition Uwe Kleine-König
2021-06-21 13:04 ` Uwe Kleine-König
2021-06-21 13:04 ` [PATCH 2/2] pwm: vt8500: Only unprepare the clock after the pwmchip was removed Uwe Kleine-König
2021-06-21 13:04   ` Uwe Kleine-König
2021-06-21 16:40 ` [PATCH 1/2] pwm: vt8500: Drop if with an always false condition Uwe Kleine-König
2021-06-21 16:40   ` Uwe Kleine-König
2021-06-22  7:41 ` Arnd Bergmann
2021-06-22  7:41   ` Arnd Bergmann

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.