Skip to content

Commit a103b83

Browse files
raagjadavandy-shev
authored andcommitted
devres: Introduce devm_kmemdup_array()
Introduce '_array' variant of devm_kmemdup() which is more robust and consistent with alloc family of helpers. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 99e297c commit a103b83

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/linux/device/devres.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ void devm_kfree(struct device *dev, const void *p);
7979

8080
void * __realloc_size(3)
8181
devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp);
82+
static inline void *devm_kmemdup_array(struct device *dev, const void *src,
83+
size_t n, size_t size, gfp_t flags)
84+
{
85+
return devm_kmemdup(dev, src, size_mul(size, n), flags);
86+
}
8287

8388
char * __malloc
8489
devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);

0 commit comments

Comments
 (0)