{Missed blank line?
return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
}
+static inline void *devm_krealloc_array(struct device *dev,I'm not sure it is what we want, but I have read the man realloc and found this:
+ void *p,
+ size_t new_n,
+ size_t new_size,
+ gfp_t flags)
+{
+ size_t bytes;
+
+ if (unlikely(check_mul_overflow(new_n, new_size, &bytes)))
+ return NULL;
... reallocarray() fails safely in the case where the multiplication
would overflow. If such an overflow occurs, reallocarray() returns NULL,
sets errno to ENOMEM, and leaves the original block of memory
unchanged.
So, perhaps you can add that this behaviour mimics reallocarray()?
+ return devm_krealloc(dev, p, bytes, flags);...
+}
All comments are minor, feel free to add
Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>