diff options
| -rw-r--r-- | drivers/hwmon/hwmon.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index adae6848ffb2..a74c075a30ec 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
| @@ -536,8 +536,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | |||
| 536 | 536 | ||
| 537 | hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), | 537 | hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), |
| 538 | GFP_KERNEL); | 538 | GFP_KERNEL); |
| 539 | if (!hwdev->groups) | 539 | if (!hwdev->groups) { |
| 540 | return ERR_PTR(-ENOMEM); | 540 | err = -ENOMEM; |
| 541 | goto free_hwmon; | ||
| 542 | } | ||
| 541 | 543 | ||
| 542 | attrs = __hwmon_create_attrs(dev, drvdata, chip); | 544 | attrs = __hwmon_create_attrs(dev, drvdata, chip); |
| 543 | if (IS_ERR(attrs)) { | 545 | if (IS_ERR(attrs)) { |
