All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>, Lukasz Majewski <lukma@denx.de>,
	Sean Anderson <seanga2@gmail.com>
Subject: [PATCH 1/7] clk: Make rfree return void
Date: Sat, 15 Jan 2022 17:24:58 -0500	[thread overview]
Message-ID: <20220115222504.617013-2-seanga2@gmail.com> (raw)
In-Reply-To: <20220115222504.617013-1-seanga2@gmail.com>

When freeing a clock there is not much we can do if there is an error, and
most callers do not actually check the return value. Even e.g. checking to
make sure that clk->id is valid should have been done in request() in the
first place (unless someone is messing with the driver behind our back).
Just return void and don't bother returning an error.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

 drivers/clk/clk-uclass.c  | 7 +++----
 drivers/clk/clk_sandbox.c | 6 +++---
 include/clk-uclass.h      | 8 +++-----
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index fca4b8321a..61f977b661 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -481,10 +481,9 @@ int clk_free(struct clk *clk)
 		return 0;
 	ops = clk_dev_ops(clk->dev);
 
-	if (!ops->rfree)
-		return 0;
-
-	return ops->rfree(clk);
+	if (ops->rfree)
+		ops->rfree(clk);
+	return 0;
 }
 
 ulong clk_get_rate(struct clk *clk)
diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c
index 57acf7d855..636914db8c 100644
--- a/drivers/clk/clk_sandbox.c
+++ b/drivers/clk/clk_sandbox.c
@@ -101,15 +101,15 @@ static int sandbox_clk_request(struct clk *clk)
 	return 0;
 }
 
-static int sandbox_clk_free(struct clk *clk)
+static void sandbox_clk_free(struct clk *clk)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
 
 	if (clk->id >= SANDBOX_CLK_ID_COUNT)
-		return -EINVAL;
+		return;
 
 	priv->requested[clk->id] = false;
-	return 0;
+	return;
 }
 
 static struct clk_ops sandbox_clk_ops = {
diff --git a/include/clk-uclass.h b/include/clk-uclass.h
index e44f1caf51..65ebff9ed2 100644
--- a/include/clk-uclass.h
+++ b/include/clk-uclass.h
@@ -32,7 +32,7 @@ struct clk_ops {
 	int (*of_xlate)(struct clk *clock,
 			struct ofnode_phandle_args *args);
 	int (*request)(struct clk *clock);
-	int (*rfree)(struct clk *clock);
+	void (*rfree)(struct clk *clock);
 	ulong (*round_rate)(struct clk *clk, ulong rate);
 	ulong (*get_rate)(struct clk *clk);
 	ulong (*set_rate)(struct clk *clk, ulong rate);
@@ -81,11 +81,9 @@ int request(struct clk *clock);
  * rfree() - Free a previously requested clock.
  * @clock:	The clock to free.
  *
- * This is the implementation of the client clk_free() API.
- *
- * Return: 0 if OK, or a negative error code.
+ * Free any resources allocated in request().
  */
-int rfree(struct clk *clock);
+void rfree(struct clk *clock);
 
 /**
  * round_rate() - Adjust a rate to the exact rate a clock can provide.
-- 
2.34.1


  reply	other threads:[~2022-01-15 22:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15 22:24 [PATCH 0/7] clk: Make clk_free return void Sean Anderson
2022-01-15 22:24 ` Sean Anderson [this message]
2022-01-27 15:05   ` [PATCH 1/7] clk: Make rfree " Simon Glass
2022-01-27 15:42     ` Sean Anderson
2022-01-27 21:35       ` Simon Glass
2022-02-01 14:49         ` Sean Anderson
2022-02-02  3:59           ` Simon Glass
2022-02-02  4:24             ` Sean Anderson
2022-02-26 18:36               ` Simon Glass
2022-02-27 19:38                 ` Sean Anderson
2022-03-01 14:58                   ` Simon Glass
2022-03-16 16:18                     ` Sean Anderson
2022-03-16 19:23                       ` Simon Glass
2022-01-15 22:24 ` [PATCH 2/7] dma: bcm6348: Don't check clk_free Sean Anderson
2022-01-15 22:25 ` [PATCH 3/7] net: bcm63xx: " Sean Anderson
2022-01-15 22:25 ` [PATCH 4/7] phy: " Sean Anderson
2022-01-15 22:25 ` [PATCH 5/7] spi: " Sean Anderson
2022-01-15 22:25 ` [PATCH 6/7] spi: dw: " Sean Anderson
2022-01-15 22:25 ` [PATCH 7/7] clk: Make clk_free return void Sean Anderson
2022-03-30 19:21 ` [PATCH 0/7] " Sean Anderson

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=20220115222504.617013-2-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --cc=lukma@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.