[PATCH 1/2] pwm: vt8500: Drop if with an always false condition

Subsystems: arm/vt8500 arm architecture, pwm subsystem, the rest

STALE1872d

4 messages, 2 authors, 2021-06-22 · open the first message on its own page

[PATCH 1/2] pwm: vt8500: Drop if with an always false condition

From: Uwe Kleine-König <hidden>
Date: 2021-06-21 13:07:11

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 <redacted>
---
 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

[PATCH 2/2] pwm: vt8500: Only unprepare the clock after the pwmchip was removed

From: Uwe Kleine-König <hidden>
Date: 2021-06-21 13:07:13

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 <redacted>
---
 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

Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition

From: Uwe Kleine-König <hidden>
Date: 2021-06-21 16:42:29

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:[off-list ref]: 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/ |

Re: [PATCH 1/2] pwm: vt8500: Drop if with an always false condition

From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-06-22 07:45:38

On Mon, Jun 21, 2021 at 3:04 PM Uwe Kleine-König
[off-list ref] 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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help