Skip to content

Commit b446631

Browse files
Jiri Pirkodavem330
authored andcommitted
dpll: fix dpll_xa_ref_*_del() for multiple registrations
Currently, if there are multiple registrations of the same pin on the same dpll device, following warnings are observed: WARNING: CPU: 5 PID: 2212 at drivers/dpll/dpll_core.c:143 dpll_xa_ref_pin_del.isra.0+0x21e/0x230 WARNING: CPU: 5 PID: 2212 at drivers/dpll/dpll_core.c:223 __dpll_pin_unregister+0x2b3/0x2c0 The problem is, that in both dpll_xa_ref_dpll_del() and dpll_xa_ref_pin_del() registration is only removed from list in case the reference count drops to zero. That is wrong, the registration has to be removed always. To fix this, remove the registration from the list and free it unconditionally, instead of doing it only when the ref reference counter reaches zero. Fixes: 9431063 ("dpll: core: Add DPLL framework base functions") Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Rahul Rameshbabu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4469c0c commit b446631

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/dpll/dpll_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ static int dpll_xa_ref_pin_del(struct xarray *xa_pins, struct dpll_pin *pin,
129129
reg = dpll_pin_registration_find(ref, ops, priv);
130130
if (WARN_ON(!reg))
131131
return -EINVAL;
132+
list_del(&reg->list);
133+
kfree(reg);
132134
if (refcount_dec_and_test(&ref->refcount)) {
133-
list_del(&reg->list);
134-
kfree(reg);
135135
xa_erase(xa_pins, i);
136136
WARN_ON(!list_empty(&ref->registration_list));
137137
kfree(ref);
@@ -209,9 +209,9 @@ dpll_xa_ref_dpll_del(struct xarray *xa_dplls, struct dpll_device *dpll,
209209
reg = dpll_pin_registration_find(ref, ops, priv);
210210
if (WARN_ON(!reg))
211211
return;
212+
list_del(&reg->list);
213+
kfree(reg);
212214
if (refcount_dec_and_test(&ref->refcount)) {
213-
list_del(&reg->list);
214-
kfree(reg);
215215
xa_erase(xa_dplls, i);
216216
WARN_ON(!list_empty(&ref->registration_list));
217217
kfree(ref);

0 commit comments

Comments
 (0)