diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-07 19:13:10 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-07 19:13:10 +0100 |
commit | 8cebec469b8b42359a2dcf9715bf74c49a755f6d (patch) | |
tree | aebbd254a5f197160ceff369b4fa1981308e94d0 | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jik... (diff) | |
parent | hwmon: (core) fix resource leak on devm_kcalloc failure (diff) | |
download | linux-8cebec469b8b42359a2dcf9715bf74c49a755f6d.tar.xz linux-8cebec469b8b42359a2dcf9715bf74c49a755f6d.zip |
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
-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)) { |