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

From: Daniel Scally
Date: Thu May 20 2021 - 10:12:22 EST


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@xxxxxxxxx>
---
Changes since v3:
- Patch introduced

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

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);
--
2.25.1