blob: 10336fc982c1f0727ecb29441b93372593803ab3 [file] [log] [blame]
From 5aede5f3cf6f6bce8a4c38d44ea4121af0e39313 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@roeck-us.net>
Date: Fri, 7 Jun 2019 13:19:12 -0700
Subject: [PATCH] hwmon: (gpio-fan) Check return value from
devm_add_action_or_reset
commit b9bb92e1d1be921e91d8b469dc1261ea5ac71991 upstream.
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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
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. */
--
2.27.0