summaryrefslogtreecommitdiff
path: root/drivers/hwmon/cgbc-hwmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/cgbc-hwmon.c')
-rw-r--r--drivers/hwmon/cgbc-hwmon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/cgbc-hwmon.c b/drivers/hwmon/cgbc-hwmon.c
index 772f44d56ccf..3aff4e092132 100644
--- a/drivers/hwmon/cgbc-hwmon.c
+++ b/drivers/hwmon/cgbc-hwmon.c
@@ -107,6 +107,9 @@ static int cgbc_hwmon_probe_sensors(struct device *dev, struct cgbc_hwmon_data *
nb_sensors = data[0];
hwmon->sensors = devm_kzalloc(dev, sizeof(*hwmon->sensors) * nb_sensors, GFP_KERNEL);
+ if (!hwmon->sensors)
+ return -ENOMEM;
+
sensor = hwmon->sensors;
for (i = 0; i < nb_sensors; i++) {