[v4,5/8] clkdev: Make clkdev_drop() null aware

Message ID 20210520140928.3252671-6-djrscally@gmail.com
State New
Headers show
Series
  • Introduce intel_skl_int3472 module
Related show

Commit Message

Daniel Scally May 20, 2021, 2:09 p.m.
To simplify error handling paths, many functions are no-ops when passed
NULL pointers, for example gpiod_remove_lookup_table(). Mirror that
behaviour for clkdev_drop().

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
Changes since v3:
	- Patch introduced

 drivers/clk/clkdev.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 0f2e3fcf0f19..c082720f8ade 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -286,6 +286,9 @@  EXPORT_SYMBOL(clk_add_alias);
  */
 void clkdev_drop(struct clk_lookup *cl)
 {
+	if (!cl)
+		return;
+
 	mutex_lock(&clocks_mutex);
 	list_del(&cl->node);
 	mutex_unlock(&clocks_mutex);