Skip to contentSkip to conversation

pwm: ab8500: Don't check the return code of pwmchip_remove()

PATCH In review zhaoxiao 2 participants 2 messages Sep 8, 2021 PWM

lore
Share & tools
lore

zhaoxiao

author
#0 lore raw

PATCH 1/1 pwm: ab8500: Don't check the return code of pwmchip_remove()

pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of ab8500_pwm_remove() and considers the device removed anyhow. So returning early results in a resource leak.

---
 drivers/pwm/pwm-ab8500.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pwm/pwm-ab8500.c +1 -4
index e2a26d9da25b..51132a076f7f 100644
@@ -113,11 +113,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
 static int ab8500_pwm_remove(struct platform_device *pdev)
 {
 	struct ab8500_pwm_chip *ab8500 = platform_get_drvdata(pdev);
-	int err;
 
-	err = pwmchip_remove(&ab8500->chip);
-	if (err < 0)
-		return err;
+	pwmchip_remove(&ab8500->chip);
 
 	dev_dbg(&pdev->dev, "pwm driver removed\n");
 
Signature · 1 line
2.20.1
#1 lore raw

Hello zhaoxiao,

Quoted 7 lines · zhaoxiao

pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of ab8500_pwm_remove() and considers the device removed anyhow. So returning early results in a resource leak.

Can you please base your patches on top of linux-next? This patch is invalid in the presence of
https://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git/commit/?h=for-next&id=14ac9e17f9bd4bd0dfe18e384a3c2ca8dfbffcc8

So this is waste of your (and my) time :-\

Best regards
Uwe

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