Message ID | 20231020085518.198477-1-suhui@nfschina.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: npcm750-pwm: add an error code check in npcm7xx_en_pwm_fan | expand |
On Fri, Oct 20, 2023 at 04:55:19PM +0800, Su Hui wrote: > npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check > the value of 'ret' after calling npcm7xx_pwm_config_set(). > > Signed-off-by: Su Hui <suhui@nfschina.com> Applied. Thanks, Guenter
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 10ed3f4335d4..4702e4edc662 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -875,6 +875,8 @@ static int npcm7xx_en_pwm_fan(struct device *dev, data->pwm_present[pwm_port] = true; ret = npcm7xx_pwm_config_set(data, pwm_port, NPCM7XX_PWM_CMR_DEFAULT_NUM); + if (ret) + return ret; ret = of_property_count_u8_elems(child, "cooling-levels"); if (ret > 0) {
npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check the value of 'ret' after calling npcm7xx_pwm_config_set(). Signed-off-by: Su Hui <suhui@nfschina.com> --- drivers/hwmon/npcm750-pwm-fan.c | 2 ++ 1 file changed, 2 insertions(+)