diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-07 10:13:10 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-07 10:13:10 -0800 |
commit | 8cebec469b8b42359a2dcf9715bf74c49a755f6d (patch) | |
tree | aebbd254a5f197160ceff369b4fa1981308e94d0 /drivers | |
parent | c1f4c2b28c11f6d042d15100b36a4ebba07c48b2 (diff) | |
parent | 38d8ed65092ed22f52a95f397855cace0260e110 (diff) | |
download | linux-8cebec469b8b42359a2dcf9715bf74c49a755f6d.tar.bz2 |
Merge tag 'hwmon-for-linus-v4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fix from Guenter Roeck:
"Fix resource leak on devm_kcalloc failure"
* tag 'hwmon-for-linus-v4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (core) fix resource leak on devm_kcalloc failure
Diffstat (limited to 'drivers')
-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, hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), GFP_KERNEL); - if (!hwdev->groups) - return ERR_PTR(-ENOMEM); + if (!hwdev->groups) { + err = -ENOMEM; + goto free_hwmon; + } attrs = __hwmon_create_attrs(dev, drvdata, chip); if (IS_ERR(attrs)) { |