Skip to content

Commit 8cebec4

Browse files
committed
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
2 parents c1f4c2b + 38d8ed6 commit 8cebec4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/hwmon/hwmon.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
536536

537537
hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups),
538538
GFP_KERNEL);
539-
if (!hwdev->groups)
540-
return ERR_PTR(-ENOMEM);
539+
if (!hwdev->groups) {
540+
err = -ENOMEM;
541+
goto free_hwmon;
542+
}
541543

542544
attrs = __hwmon_create_attrs(dev, drvdata, chip);
543545
if (IS_ERR(attrs)) {

0 commit comments

Comments
 (0)