Skip to content

Commit ced245a

Browse files
Jiri PirkoSasha Levin
authored andcommitted
dpll: check that pin is registered in __dpll_pin_unregister()
[ Upstream commit 9736c64 ] 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]> Stable-dep-of: 38d7b94 ("dpll: fix dpll_pin_on_pin_register() for multiple parent pins") Signed-off-by: Sasha Levin <[email protected]>
1 parent cbed568 commit ced245a

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;
@@ -651,6 +653,7 @@ static void
651653
__dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
652654
const struct dpll_pin_ops *ops, void *priv)
653655
{
656+
ASSERT_DPLL_PIN_REGISTERED(pin);
654657
dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv);
655658
dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv);
656659
if (xa_empty(&pin->dpll_refs))

0 commit comments

Comments
 (0)