Skip to contentSkip to conversation

hwmon: npcm750-pwm: add an error code check in npcm7xx_en_pwm_fan

PATCH Applied Su Hui 2 participants 2 messages Oct 20, 2023 – Oct 25, 2023

Subsystems (4)
lore
Share & tools
lore

Su Hui

author
#0 lore raw

PATCH 1/1 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().

---
 drivers/hwmon/npcm750-pwm-fan.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/npcm750-pwm-fan.c +2 -0
index 10ed3f4335d4..4702e4edc662 100644
@@ -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) {
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Su Hui

npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check the value of 'ret' after calling npcm7xx_pwm_config_set().

Applied.

Thanks,
Guenter