devres: add kernel standard devm_k.alloc functions
authorJoe Perches <joe@perches.com>
Mon, 19 May 2014 13:14:34 +0000 (14:14 +0100)
committerMark Brown <broonie@linaro.org>
Mon, 19 May 2014 16:58:52 +0000 (17:58 +0100)
commit266a1aedb2d55c3fe9db93c5f6646942d4781cb6
treee5ddc214d22fba1919493bac225c173e8a5256bb
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376
devres: add kernel standard devm_k.alloc functions

Currently, devm_ managed memory only supports kzalloc.

Convert the devm_kzalloc implementation to devm_kmalloc and remove the
complete memset to 0 but still set the initial struct devres header and
whatever padding before data to 0.

Add the other normal alloc variants as static inlines with __GFP_ZERO
added to the gfp flag where appropriate:

devm_kzalloc
devm_kcalloc
devm_kmalloc_array

Add gfp.h to device.h for the newly added static inlines.

akpm: the current API forces us to replace kmalloc() with kzalloc() when
performing devm_ conversions.  This adds a relatively minor overhead.
More significantly, it will defeat kmemcheck used-uninitialized checking,
and for a particular driver, losing used-uninitialised checking for their
core controlling data structures will significantly degrade kmemcheck
usefulness.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 64c862a839a8db2c02bbaa88b923d13e1208919d)
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/devres.c
include/linux/device.h