[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230612164515.6eacefb1@kernel.org>
Date: Mon, 12 Jun 2023 16:45:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
Cc: jiri@...nulli.us, vadfed@...a.com, jonathan.lemon@...il.com,
pabeni@...hat.com, corbet@....net, davem@...emloft.net,
edumazet@...gle.com, vadfed@...com, jesse.brandeburg@...el.com,
anthony.l.nguyen@...el.com, saeedm@...dia.com, leon@...nel.org,
richardcochran@...il.com, sj@...nel.org, javierm@...hat.com,
ricardo.canuelo@...labora.com, mst@...hat.com, tzimmermann@...e.de,
michal.michalik@...el.com, gregkh@...uxfoundation.org,
jacek.lawrynowicz@...ux.intel.com, airlied@...hat.com, ogabbay@...nel.org,
arnd@...db.de, nipun.gupta@....com, axboe@...nel.dk, linux@...y.sk,
masahiroy@...nel.org, benjamin.tissoires@...hat.com,
geert+renesas@...der.be, milena.olech@...el.com, kuniyu@...zon.com,
liuhangbin@...il.com, hkallweit1@...il.com, andy.ren@...cruise.com,
razor@...ckwall.org, idosch@...dia.com, lucien.xin@...il.com,
nicolas.dichtel@...nd.com, phil@....cc, claudiajkang@...il.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
linux-rdma@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
poros@...hat.com, mschmidt@...hat.com, linux-clk@...r.kernel.org,
vadim.fedorenko@...ux.dev
Subject: Re: [RFC PATCH v8 03/10] dpll: core: Add DPLL framework base
functions
On Fri, 9 Jun 2023 14:18:46 +0200 Arkadiusz Kubalewski wrote:
> + xa_for_each(xa_pins, i, ref) {
> + if (ref->pin != pin)
> + continue;
> + reg = dpll_pin_registration_find(ref, ops, priv);
> + if (reg) {
> + refcount_inc(&ref->refcount);
> + return 0;
> + }
> + ref_exists = true;
> + break;
> + }
> +
> + if (!ref_exists) {
> + ref = kzalloc(sizeof(*ref), GFP_KERNEL);
> + if (!ref)
> + return -ENOMEM;
> + ref->pin = pin;
> + INIT_LIST_HEAD(&ref->registration_list);
> + ret = xa_insert(xa_pins, pin->pin_idx, ref, GFP_KERNEL);
> + if (ret) {
> + kfree(ref);
> + return ret;
> + }
> + refcount_set(&ref->refcount, 1);
> + }
> +
> + reg = kzalloc(sizeof(*reg), GFP_KERNEL);
Why do we have two structures - ref and reg?
> + if (!reg) {
> + if (!ref_exists)
> + kfree(ref);
ref has already been inserted into xa_pins
> + return -ENOMEM;
Powered by blists - more mailing lists