aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5517944495d8..c42e608af6bb 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2226,24 +2226,25 @@ EXPORT_SYMBOL_GPL(devm_clk_unregister);
2226 */ 2226 */
2227int __clk_get(struct clk *clk) 2227int __clk_get(struct clk *clk)
2228{ 2228{
2229 if (clk && !try_module_get(clk->owner)) 2229 if (clk) {
2230 return 0; 2230 if (!try_module_get(clk->owner))
2231 return 0;
2231 2232
2232 kref_get(&clk->ref); 2233 kref_get(&clk->ref);
2234 }
2233 return 1; 2235 return 1;
2234} 2236}
2235 2237
2236void __clk_put(struct clk *clk) 2238void __clk_put(struct clk *clk)
2237{ 2239{
2238 if (WARN_ON_ONCE(IS_ERR(clk))) 2240 if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
2239 return; 2241 return;
2240 2242
2241 clk_prepare_lock(); 2243 clk_prepare_lock();
2242 kref_put(&clk->ref, __clk_release); 2244 kref_put(&clk->ref, __clk_release);
2243 clk_prepare_unlock(); 2245 clk_prepare_unlock();
2244 2246
2245 if (clk) 2247 module_put(clk->owner);
2246 module_put(clk->owner);
2247} 2248}
2248 2249
2249/*** clk rate change notifiers ***/ 2250/*** clk rate change notifiers ***/