Fix resource leak on devm_kcalloc failure

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYH06YAAoJEMsfJm/On5mBN48P/izq+Zj7Q6QgO8Cc8ImsOrAa
 kRr1oNNjhfdTdRevaC3fg3cvMD7oz9GsAIQd2tdHaeeUFIrJHxDMeTpjbJftZeNp
 vs3OCSzFQo9yEaYYw+3iJWYaszzPNOGnxvFNsQ2flBslG8ToKrHHYcGWX/LuZGoD
 jeQwbcuWGNVoF1/uUe8vUerzRobTrJl/Xm2HY73BzjGsAJl/NdeaYAOF4EcxdN12
 hED1RDs7Hh9qAEXxGZWDjV6Cxg5qNHgqmtsdpG0dM9H6Tk+53wZP9u8dugtz2Hqg
 WutmFn+66AcErWls/6IQt37pzBOaGV/bAflaUsRq6lsE6ehJl8ByOHrt+10Hr0S5
 ZJRwzc/5DhlCE5vOltBRPah5BHpST+sJW+zgQbAIAHuTD14fuRcqJfhr7J6pXukM
 KWGAM3fWxeNy+83Zcz1P54DTyeCKFRdW28/IH0GmAOYa4htaXr0qXIzALQxwwdQD
 tvt0UXDRCpVdCVxdJVd/jD+jyvON5Y/VmE4/dxYKLmGwCXfdYWGUImIFiMLrLAoI
 7WCEjo+rbd+NX3HirrHvUThCs/DXlybtKEfvX5z+96Zji09Q4nEngRl6sEg/g6DH
 SNjBbu7UihhQWazGHmLu/YVbTuGW6gzzTqIr23hn7lcjK9wpzm+yiyuRlbb9cvAo
 pVEa8ZmXmC7iXYbHiSxR
 =01JQ
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2016-11-07 10:13:10 -08:00
commit 8cebec469b

View File

@ -536,8 +536,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups),
GFP_KERNEL); GFP_KERNEL);
if (!hwdev->groups) if (!hwdev->groups) {
return ERR_PTR(-ENOMEM); err = -ENOMEM;
goto free_hwmon;
}
attrs = __hwmon_create_attrs(dev, drvdata, chip); attrs = __hwmon_create_attrs(dev, drvdata, chip);
if (IS_ERR(attrs)) { if (IS_ERR(attrs)) {