summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/npcm750-pwm-fan.c
diff options
context:
space:
mode:
authorSu Hui <suhui@nfschina.com>2023-10-20 10:55:19 +0200
committerGuenter Roeck <linux@roeck-us.net>2023-10-28 18:21:36 +0200
commitb92b2984a5b62099ab7731bc3a30a0d7c83a01d4 (patch)
treecb063573b6b87553a0106723c275eb4e073b4b66 /drivers/hwmon/npcm750-pwm-fan.c
parenthwmon: (hs3001) remove redundant store on division (diff)
downloadlinux-b92b2984a5b62099ab7731bc3a30a0d7c83a01d4.tar.xz
linux-b92b2984a5b62099ab7731bc3a30a0d7c83a01d4.zip
hwmon: (npcm750-pwm) Add an error code check in npcm7xx_en_pwm_fan
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> Link: https://lore.kernel.org/r/20231020085518.198477-1-suhui@nfschina.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to '')
-rw-r--r--drivers/hwmon/npcm750-pwm-fan.c2
1 files changed, 2 insertions, 0 deletions
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) {