On Thu, Dec 06, 2018 at 06:10:47PM +, Robin Murphy wrote:
> AFAICS the tmp list wasn't about locking as much as meaning that if
> kzalloc() failed at any point, we can free the partial allocation and back
> out without disturbing free_entries at all - that still makes sense to me
> up until
On 06/12/2018 14:23, Christoph Hellwig wrote:
+static int dma_debug_add_entries(u32 num_entries, gfp_t gfp)
+{
+ struct dma_debug_entry *entry, *next_entry;
+ LIST_HEAD(tmp);
+ int i;
+
+ for (i = 0; i < num_entries; ++i) {
+ entry = kzalloc(sizeof(*entry),
> +static int dma_debug_add_entries(u32 num_entries, gfp_t gfp)
> +{
> + struct dma_debug_entry *entry, *next_entry;
> + LIST_HEAD(tmp);
> + int i;
> +
> + for (i = 0; i < num_entries; ++i) {
> + entry = kzalloc(sizeof(*entry), gfp);
> + if (!entry)
> +
Make the prealloc_memory() logic a little more general and robust so
that it serves for runtime reallocations too. The first thing we can
do with that is clean up dma_debug_resize_entries() a bit.
Signed-off-by: Robin Murphy
---
v2: Give it a better name, simplify the locking mess