]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (pmbus) Use krealloc to allocate attribute memory
authorGuenter Roeck <linux@roeck-us.net>
Mon, 21 Jan 2013 05:00:01 +0000 (21:00 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 6 Feb 2013 17:58:03 +0000 (09:58 -0800)
commit9d6583a89ff7b23766b9530f7238b5ab24295ef4
tree99ecfa2660a4a8cf7c695ed93091dcba798d3411
parentb4041e2a5cd7d115798597a33d4847f84c8ebcf1
hwmon: (pmbus) Use krealloc to allocate attribute memory

So far, attribute memory was allocated by pre-calculating the maximum possible
amount of attributes. Not only does this waste memory, it is also risky because
the calculation might be wrong. It also requires a lot of defines to specify
the maximum number of attributes per class.

Allocate attribute memory using krealloc() instead. That means we have to use
kfree(), since devm_krealloc() does not exist, but that is still less costly
and less risky than trying to predict the number of attributes at the beginning.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c