Skip to content

Commit 9736c64

Browse files
Jiri Pirkokuba-moo
authored andcommitted
dpll: check that pin is registered in __dpll_pin_unregister()
Similar to what is done in dpll_device_unregister(), add assertion to __dpll_pin_unregister() to make sure driver does not try to unregister non-registered pin. Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Vadim Fedorenko <[email protected]> Reviewed-by: Arkadiusz Kubalewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c474dd5 commit 9736c64

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/dpll/dpll_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id;
2929
WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
3030
#define ASSERT_DPLL_NOT_REGISTERED(d) \
3131
WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
32+
#define ASSERT_DPLL_PIN_REGISTERED(p) \
33+
WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
3234

3335
struct dpll_device_registration {
3436
struct list_head list;
@@ -631,6 +633,7 @@ static void
631633
__dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
632634
const struct dpll_pin_ops *ops, void *priv)
633635
{
636+
ASSERT_DPLL_PIN_REGISTERED(pin);
634637
dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv);
635638
dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv);
636639
if (xa_empty(&pin->dpll_refs))

0 commit comments

Comments
 (0)