@@ -413,7 +413,7 @@ static int pwm_class_resume_npwm(struct device *parent, unsigned int npwm)
{
struct pwm_chip *chip = dev_get_drvdata(parent);
unsigned int i;
- int ret = 0;
+ int ret;
for (i = 0; i < npwm; i++) {
struct pwm_device *pwm = &chip->pwms[i];
@@ -427,17 +427,17 @@ static int pwm_class_resume_npwm(struct device *parent, unsigned int npwm)
state.enabled = export->suspend.enabled;
ret = pwm_class_apply_state(export, pwm, &state);
if (ret < 0)
- break;
+ return ret;
}
- return ret;
+ return 0;
}
static int pwm_class_suspend(struct device *parent)
{
struct pwm_chip *chip = dev_get_drvdata(parent);
unsigned int i;
- int ret = 0;
+ int ret;
for (i = 0; i < chip->npwm; i++) {
struct pwm_device *pwm = &chip->pwms[i];
@@ -457,11 +457,11 @@ static int pwm_class_suspend(struct device *parent)
* this suspend function.
*/
pwm_class_resume_npwm(parent, i);
- break;
+ return ret;
}
}
- return ret;
+ return 0;
}
static int pwm_class_resume(struct device *parent)
There is no need to assign ret to 0 and then break the loop just for returning the error to the caller. Instead, return directly from the for-loop, and 0 otherwise. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pwm/sysfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)