Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp463964rwd; Mon, 12 Jun 2023 16:59:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iJ1XRPuba5FUvtK9MG5lqrR+jQH1vkB3Cah6aVgPApLqDf/UwEkIMeW/s7/3hI/yLoOUP X-Received: by 2002:a17:907:9811:b0:97e:aace:b6bc with SMTP id ji17-20020a170907981100b0097eaaceb6bcmr6796039ejc.53.1686614378216; Mon, 12 Jun 2023 16:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686614378; cv=none; d=google.com; s=arc-20160816; b=e3INAksdrBJ4VJOIvfvU7nduU+s88JnKKEYWPtot54TdsmoXhx4rH2pU58rGFrucl6 50qgdQO77mQmAgu3VguYpWgSm/Ga5tAK8Cg37Bn/ZtWUzJmNTBWHOE6SDLTFH3AUxY6x S98x8o+xNud2Qvla0LZRm1tYIILXpUS7bY5t9AgHU3AltQOx2Gn4GT4vMHzyiLrpqsZm 4jty02NLjcwkAqDzkY0nxLGfxbZUWAczit7aZMo/QgfsATR9jIAXNrEkpb0Fo6/WzMm/ ZK1rlSnvavAGCi+SLssJCoj8LsLgxKSAvAInl/k0eVPOFlLPayGka9X+T4Ogs89KW0jw 6HKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jUwF/gbFw2yG5x0kl38lALv5+Yh2q02fDUoYDK5uFLY=; b=K53zd1AltwL8S/fnmhIPyATxFYYHno84I42i+/UpKjcKyuybjdVsXZTY9Smgpxj2xY zexig2cQl7DFn24GNKrGlobTQznZAN/piA63Mhqj7rHxKid0cdiflgYWIIB0/i0KFV8O d2IPAY1KIysDoI55Q3UpKYmhZPWiNT7fyEdR9awGczxO/Rk2Nh1oHb1KNBYaj9qUJ2et z206i//5uCfoIET0NF2esdnFmDxVHYpaD57+k12eI1CF8jA/ZCF3JnZfpC+HxG167yxw i1qkh8ss9JtVxw4cmYCQFq1kq0jF9p9Fx6rFFKMiDWiXDGba9zKH4lkf3pHKsu02axLE sOOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J/MbfG7M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a1709062e8e00b009786c0d0d15si6219706eji.315.2023.06.12.16.59.13; Mon, 12 Jun 2023 16:59:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J/MbfG7M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237583AbjFLXpV (ORCPT + 99 others); Mon, 12 Jun 2023 19:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbjFLXpU (ORCPT ); Mon, 12 Jun 2023 19:45:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF5110F9; Mon, 12 Jun 2023 16:45:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09359617D1; Mon, 12 Jun 2023 23:45:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6862DC433EF; Mon, 12 Jun 2023 23:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686613518; bh=wiSNyZ18E7j0+vGKZGV00souZm1bq4VUlxQ/AgkGk+M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=J/MbfG7MqX/927qmjvcVnKooeZ6fLV4ndi1AMb2SvblEdbUjlOz3OsBYSj7Hb2YxX p1UDScovbSf5bMhh7Wj5E9CIrguJ/9jISL1SL83WoQmh0XafXF+1pYkc/JWTCq0QZP w8RNro1J+vNs9ODuH5Ry+9ABjZh9vMybvqv3FnW/Xa1DFv4gHlkZUV3ONDL42+45kw 9NkF5K7GWjvQHRD84IifFKUHQefevWPmINHyeKebUTarV7OZnETKsrrZdIvVFml7YD Q5pXXPFTmIdOttGbUj2lZ+nxblghEnDRRXezc++cLqoqTE3lmI61WYh+dktineV29n VYg0dlPUojOKg== Date: Mon, 12 Jun 2023 16:45:15 -0700 From: Jakub Kicinski To: Arkadiusz Kubalewski Cc: jiri@resnulli.us, vadfed@meta.com, jonathan.lemon@gmail.com, pabeni@redhat.com, corbet@lwn.net, davem@davemloft.net, edumazet@google.com, vadfed@fb.com, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, saeedm@nvidia.com, leon@kernel.org, richardcochran@gmail.com, sj@kernel.org, javierm@redhat.com, ricardo.canuelo@collabora.com, mst@redhat.com, tzimmermann@suse.de, michal.michalik@intel.com, gregkh@linuxfoundation.org, jacek.lawrynowicz@linux.intel.com, airlied@redhat.com, ogabbay@kernel.org, arnd@arndb.de, nipun.gupta@amd.com, axboe@kernel.dk, linux@zary.sk, masahiroy@kernel.org, benjamin.tissoires@redhat.com, geert+renesas@glider.be, milena.olech@intel.com, kuniyu@amazon.com, liuhangbin@gmail.com, hkallweit1@gmail.com, andy.ren@getcruise.com, razor@blackwall.org, idosch@nvidia.com, lucien.xin@gmail.com, nicolas.dichtel@6wind.com, phil@nwl.cc, claudiajkang@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org, linux-arm-kernel@lists.infradead.org, poros@redhat.com, mschmidt@redhat.com, linux-clk@vger.kernel.org, vadim.fedorenko@linux.dev Subject: Re: [RFC PATCH v8 03/10] dpll: core: Add DPLL framework base functions Message-ID: <20230612164515.6eacefb1@kernel.org> In-Reply-To: <20230609121853.3607724-4-arkadiusz.kubalewski@intel.com> References: <20230609121853.3607724-1-arkadiusz.kubalewski@intel.com> <20230609121853.3607724-4-arkadiusz.kubalewski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;