mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
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: 9431063ad3
("dpll: core: Add DPLL framework base functions")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4469c0c5b1
commit
b446631f35
@ -129,9 +129,9 @@ static int dpll_xa_ref_pin_del(struct xarray *xa_pins, struct dpll_pin *pin,
|
|||||||
reg = dpll_pin_registration_find(ref, ops, priv);
|
reg = dpll_pin_registration_find(ref, ops, priv);
|
||||||
if (WARN_ON(!reg))
|
if (WARN_ON(!reg))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
list_del(®->list);
|
||||||
|
kfree(reg);
|
||||||
if (refcount_dec_and_test(&ref->refcount)) {
|
if (refcount_dec_and_test(&ref->refcount)) {
|
||||||
list_del(®->list);
|
|
||||||
kfree(reg);
|
|
||||||
xa_erase(xa_pins, i);
|
xa_erase(xa_pins, i);
|
||||||
WARN_ON(!list_empty(&ref->registration_list));
|
WARN_ON(!list_empty(&ref->registration_list));
|
||||||
kfree(ref);
|
kfree(ref);
|
||||||
@ -209,9 +209,9 @@ dpll_xa_ref_dpll_del(struct xarray *xa_dplls, struct dpll_device *dpll,
|
|||||||
reg = dpll_pin_registration_find(ref, ops, priv);
|
reg = dpll_pin_registration_find(ref, ops, priv);
|
||||||
if (WARN_ON(!reg))
|
if (WARN_ON(!reg))
|
||||||
return;
|
return;
|
||||||
|
list_del(®->list);
|
||||||
|
kfree(reg);
|
||||||
if (refcount_dec_and_test(&ref->refcount)) {
|
if (refcount_dec_and_test(&ref->refcount)) {
|
||||||
list_del(®->list);
|
|
||||||
kfree(reg);
|
|
||||||
xa_erase(xa_dplls, i);
|
xa_erase(xa_dplls, i);
|
||||||
WARN_ON(!list_empty(&ref->registration_list));
|
WARN_ON(!list_empty(&ref->registration_list));
|
||||||
kfree(ref);
|
kfree(ref);
|
||||||
|
Loading…
Reference in New Issue
Block a user