From: Uwe Kleine-König Date: Fri, 23 Apr 2021 16:59:02 +0000 (+0200) Subject: pwm: Drop irrelevant error path from pwmchip_remove() X-Git-Tag: v5.14-rc1~42^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad5e085c63f59391f5cfbde64fbff192872dfe8f;p=thirdparty%2Fkernel%2Flinux.git pwm: Drop irrelevant error path from pwmchip_remove() Since the PWM core uses device links (commit b2c200e3f2fd ("pwm: Add consumer device link")) each consumer driver that requested the PWMs is already gone. If they called pwm_put() (as they should) the PWMF_REQUESTED bit is not set. If they failed (which is a bug) the PWMF_REQUESTED bit might still be set, but the driver that cared is gone, so nothing bad happens if the PWM chip goes away even if the PWMF_REQUESTED is still present. So the check can be dropped. With this change pwmchip_remove() returns always 0, so lowlevel drivers don't need to check the return code any more. Once all drivers dropped this check this function can be changed to return void. Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding --- diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 83db178f16bb7..a88e13c8a53c2 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -306,22 +306,10 @@ EXPORT_SYMBOL_GPL(pwmchip_add); */ int pwmchip_remove(struct pwm_chip *chip) { - unsigned int i; - int ret = 0; - pwmchip_sysfs_unexport(chip); mutex_lock(&pwm_lock); - for (i = 0; i < chip->npwm; i++) { - struct pwm_device *pwm = &chip->pwms[i]; - - if (test_bit(PWMF_REQUESTED, &pwm->flags)) { - ret = -EBUSY; - goto out; - } - } - list_del_init(&chip->list); if (IS_ENABLED(CONFIG_OF)) @@ -329,9 +317,9 @@ int pwmchip_remove(struct pwm_chip *chip) free_pwms(chip); -out: mutex_unlock(&pwm_lock); - return ret; + + return 0; } EXPORT_SYMBOL_GPL(pwmchip_remove);