This will make porting helpers easier, because it's harder to miss
error checking.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 include/linux/clk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 481c28871258..ffc1ac8489b0 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -432,12 +432,12 @@ struct clk_hw {
 
 static inline struct clk *clk_hw_to_clk(struct clk_hw *hw)
 {
-       return &hw->clk;
+       return IS_ERR(hw) ? ERR_CAST(hw) : &hw->clk;
 }
 
 static inline struct clk_hw *clk_to_clk_hw(struct clk *clk)
 {
-       return container_of(clk, struct clk_hw, clk);
+       return IS_ERR(clk) ? ERR_CAST(clk) : container_of(clk, struct clk_hw, 
clk);
 }
 
 struct clk_div_table {
-- 
2.33.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to