Skip to content

Commit

Permalink
Merge tag 'hwmon-for-linus-v4.9-rc5' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Nov 7, 2016
2 parents c1f4c2b + 38d8ed6 commit 8cebec4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwmon/hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 8cebec4

Please sign in to comment.