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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 drivers/hwmon/npcm750-pwm-fan.c | 2 ++
 1 file changed, 2 insertions(+)

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) {
-- 
2.30.2




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux