Thread (73 messages) 73 messages, 8 authors, 2023-07-17

Re: [RFC PATCH v8 03/10] dpll: core: Add DPLL framework base functions

From: Jakub Kicinski <kuba@kernel.org>
Date: 2023-06-12 23:45:23
Also in: intel-wired-lan, linux-clk, linux-doc, linux-rdma, lkml

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;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help