diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-08-24 19:38:57 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-08 13:32:06 +0200 |
commit | f82485722e5de5ebb08d3a1dd7302203346dbff9 (patch) | |
tree | 66114964163c5ce91e43c99e4cbc0f4b6eebfaa0 /include/linux/device.h | |
parent | 81b142245b6f0249896325c7e8451cb5347d4d31 (diff) | |
download | linux-stable-f82485722e5de5ebb08d3a1dd7302203346dbff9.tar.gz linux-stable-f82485722e5de5ebb08d3a1dd7302203346dbff9.tar.bz2 linux-stable-f82485722e5de5ebb08d3a1dd7302203346dbff9.zip |
devres: provide devm_krealloc()
Implement the managed variant of krealloc(). This function works with
all memory allocated by devm_kmalloc() (or devres functions using it
implicitly like devm_kmemdup(), devm_kstrdup() etc.).
Managed realloc'ed chunks can be manually released with devm_kfree().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200824173859.4910-2-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index bf480dbe3375..85d5c28bed93 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -206,6 +206,8 @@ int devres_release_group(struct device *dev, void *id); /* managed devm_k.alloc/kfree for device drivers */ void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; +void *devm_krealloc(struct device *dev, void *ptr, size_t size, + gfp_t gfp) __must_check; __printf(3, 0) char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, va_list ap) __malloc; __printf(3, 4) char *devm_kasprintf(struct device *dev, gfp_t gfp, |