dpll: check that pin is registered in __dpll_pin_unregister()
Subsystems (3)
Jiri Pirko
maintainerPATCH 1/1 dpll: check that pin is registered in __dpll_pin_unregister()
From: Jiri Pirko <[email protected]>
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.
--- drivers/dpll/dpll_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/dpll/dpll_core.c +3 -0
@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id; WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))#define ASSERT_DPLL_NOT_REGISTERED (d) \ WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED)) +#define ASSERT_DPLL_PIN_REGISTERED (p) \ + WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))struct dpll_device_registration {struct list_head list;
@@ -631,6 +633,7 @@ static void __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv) { +ASSERT_DPLL_PIN_REGISTERED (pin);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv);if (xa_empty (&pin->dpll_refs))
Signature · 1 line
2.43.0
Quoted 25 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
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]>--- drivers/dpll/dpll_core.c | 3 +++ 1 file changed, 3 insertions(+)drivers/dpll/dpll_core.c +2
-0@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id; WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))#define ASSERT_DPLL_NOT_REGISTERED (d) \ WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED)) +#define ASSERT_DPLL_PIN_REGISTERED (p) \ + WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))struct dpll_device_registration {struct list_head list;
drivers/dpll/dpll_core.c static void · line 639
Quoted 7 lines
drivers/dpll/dpll_core.c +1
-0@@ -631,6 +633,7 @@ static void __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv) { +ASSERT_DPLL_PIN_REGISTERED (pin);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv);if (xa_empty (&pin->dpll_refs))
Quoted 36 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, February 6, 2024 8:49 AMFrom: Jiri Pirko <[email protected]>
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]>---
drivers/dpll/dpll_core.c| 3 +++1 file changed, 3 insertions(+)drivers/dpll/dpll_core.c +3
-1@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id; WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))#define ASSERT_DPLL_NOT_REGISTERED (d) \ WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED)) +#define ASSERT_DPLL_PIN_REGISTERED (p) \ + WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))struct dpll_device_registration {struct list_head list;@@ -631,6 +633,7 @@ static void __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv) { +ASSERT_DPLL_PIN_REGISTERED (pin);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv);if (xa_empty (&pin->dpll_refs)) --
Quoted 1 line
2.43.0
LGTM, Thank you!
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 6 Feb 2024 08:48:53 +0100 you wrote:
From: Jiri Pirko <[email protected]>
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]>[...]
Here is the summary with links:
- [net-next] dpll: check that pin is registered in __dpll_pin_unregister()
https://git.kernel.org/netdev/net-next/c/9736c648370d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html