summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gpio-fan.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2019-06-07 13:19:12 -0700
committerGuenter Roeck <linux@roeck-us.net>2019-06-23 18:32:34 -0700
commitb9bb92e1d1be921e91d8b469dc1261ea5ac71991 (patch)
tree5e1dd447b0b10d10a7926065ea43216e640134e2 /drivers/hwmon/gpio-fan.c
parent4b972a01a7da614b4796475f933094751a295a2f (diff)
downloadlinux-b9bb92e1d1be921e91d8b469dc1261ea5ac71991.tar.bz2
hwmon: (gpio-fan) Check return value from devm_add_action_or_reset
devm_add_action_or_reset() can fail due to a memory allocation failure. Check for it and return the error if that happens. Fixes: 9534784550ab ("hwmon: (gpio-fan) Use devm_thermal_of_cooling_device_register") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r--drivers/hwmon/gpio-fan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 84753680a4e8..54c27e683ee1 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -524,7 +524,9 @@ static int gpio_fan_probe(struct platform_device *pdev)
err = fan_ctrl_init(fan_data);
if (err)
return err;
- devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
+ err = devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
+ if (err)
+ return err;
}
/* Make this driver part of hwmon class. */