mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: [PATCH 2/2] clk: propagate error pointers in clk_hw_to_clk and clk_to_clk_hw
Date: Fri, 14 Jan 2022 07:59:53 +0100	[thread overview]
Message-ID: <20220114065953.698483-2-ahmad@a3f.at> (raw)
In-Reply-To: <20220114065953.698483-1-ahmad@a3f.at>

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

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-01-14  7:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  6:59 [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Ahmad Fatoum
2022-01-14  6:59 ` Ahmad Fatoum [this message]
2022-01-14  8:26 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220114065953.698483-2-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox