[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230321204028.20e5a27e@kernel.org>
Date: Tue, 21 Mar 2023 20:40:28 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Saeed Mahameed <saeed@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Saeed Mahameed <saeedm@...dia.com>, netdev@...r.kernel.org,
Tariq Toukan <tariqt@...dia.com>, Eli Cohen <elic@...dia.com>
Subject: Re: [net-next 02/14] lib: cpu_rmap: Use allocator for rmap entries
On Mon, 20 Mar 2023 10:51:32 -0700 Saeed Mahameed wrote:
> +static int get_free_index(struct cpu_rmap *rmap)
> +{
> + int i;
> +
> + for (i = 0; i < rmap->size; i++)
> + if (!rmap->obj[i])
> + return i;
> +
> + return -1;
-ENOSPC, why invent a special value ..
> @@ -295,7 +307,11 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq)
> glue->notify.release = irq_cpu_rmap_release;
> glue->rmap = rmap;
> cpu_rmap_get(rmap);
> - glue->index = cpu_rmap_add(rmap, glue);
> + rc = cpu_rmap_add(rmap, glue);
> + if (rc == -1)
> + return -ENOSPC;
which you then have to convert into an errno ?
Also you leak glue here.
Powered by blists - more mailing lists