From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Neil Armstrong <narmstrong@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-crypto@vger.kernel.org, kernel@pengutronix.de,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Jerome Brunet <jbrunet@baylibre.com>
Subject: [PATCH v2] hwrng: meson - Improve error handling for core clock
Date: Mon, 20 Sep 2021 09:44:05 +0200 [thread overview]
Message-ID: <20210920074405.252477-1-u.kleine-koenig@pengutronix.de> (raw)
-ENOENT (ie. "there is no clock") is fine to ignore for an optional
clock, other values are not supposed to be ignored and should be
escalated to the caller (e.g. -EPROBE_DEFER). Ignore -ENOENT by using
devm_clk_get_optional().
While touching this code also add an error message for the fatal errors.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
compared to (implicit) v1
(https://lore.kernel.org/r/20210914142428.57099-1-u.kleine-koenig@pengutronix.de)
this used dev_err_probe() as suggested by Martin Blumenstingl.
v1 got a "Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>", I didn't add
that because of the above change.
(Hmm, my setup is broken, the b4 patch signature was done before I added this
message. I wonder if this will break the signature ...)
Best regards
Uwe
drivers/char/hw_random/meson-rng.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c
index e446236e81f2..8bb30282ca46 100644
--- a/drivers/char/hw_random/meson-rng.c
+++ b/drivers/char/hw_random/meson-rng.c
@@ -54,9 +54,10 @@ static int meson_rng_probe(struct platform_device *pdev)
if (IS_ERR(data->base))
return PTR_ERR(data->base);
- data->core_clk = devm_clk_get(dev, "core");
+ data->core_clk = devm_clk_get_optional(dev, "core");
if (IS_ERR(data->core_clk))
- data->core_clk = NULL;
+ return dev_err_probe(dev, PTR_ERR(data->core_clk),
+ "Failed to get core clock\n");
if (data->core_clk) {
ret = clk_prepare_enable(data->core_clk);
base-commit: 7d2a07b769330c34b4deabeed939325c77a7ec2f
--
2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Neil Armstrong <narmstrong@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-crypto@vger.kernel.org, kernel@pengutronix.de,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Jerome Brunet <jbrunet@baylibre.com>
Subject: [PATCH v2] hwrng: meson - Improve error handling for core clock
Date: Mon, 20 Sep 2021 09:44:05 +0200 [thread overview]
Message-ID: <20210920074405.252477-1-u.kleine-koenig@pengutronix.de> (raw)
-ENOENT (ie. "there is no clock") is fine to ignore for an optional
clock, other values are not supposed to be ignored and should be
escalated to the caller (e.g. -EPROBE_DEFER). Ignore -ENOENT by using
devm_clk_get_optional().
While touching this code also add an error message for the fatal errors.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
compared to (implicit) v1
(https://lore.kernel.org/r/20210914142428.57099-1-u.kleine-koenig@pengutronix.de)
this used dev_err_probe() as suggested by Martin Blumenstingl.
v1 got a "Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>", I didn't add
that because of the above change.
(Hmm, my setup is broken, the b4 patch signature was done before I added this
message. I wonder if this will break the signature ...)
Best regards
Uwe
drivers/char/hw_random/meson-rng.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c
index e446236e81f2..8bb30282ca46 100644
--- a/drivers/char/hw_random/meson-rng.c
+++ b/drivers/char/hw_random/meson-rng.c
@@ -54,9 +54,10 @@ static int meson_rng_probe(struct platform_device *pdev)
if (IS_ERR(data->base))
return PTR_ERR(data->base);
- data->core_clk = devm_clk_get(dev, "core");
+ data->core_clk = devm_clk_get_optional(dev, "core");
if (IS_ERR(data->core_clk))
- data->core_clk = NULL;
+ return dev_err_probe(dev, PTR_ERR(data->core_clk),
+ "Failed to get core clock\n");
if (data->core_clk) {
ret = clk_prepare_enable(data->core_clk);
base-commit: 7d2a07b769330c34b4deabeed939325c77a7ec2f
--
2.30.2
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Neil Armstrong <narmstrong@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-crypto@vger.kernel.org, kernel@pengutronix.de,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Jerome Brunet <jbrunet@baylibre.com>
Subject: [PATCH v2] hwrng: meson - Improve error handling for core clock
Date: Mon, 20 Sep 2021 09:44:05 +0200 [thread overview]
Message-ID: <20210920074405.252477-1-u.kleine-koenig@pengutronix.de> (raw)
-ENOENT (ie. "there is no clock") is fine to ignore for an optional
clock, other values are not supposed to be ignored and should be
escalated to the caller (e.g. -EPROBE_DEFER). Ignore -ENOENT by using
devm_clk_get_optional().
While touching this code also add an error message for the fatal errors.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
compared to (implicit) v1
(https://lore.kernel.org/r/20210914142428.57099-1-u.kleine-koenig@pengutronix.de)
this used dev_err_probe() as suggested by Martin Blumenstingl.
v1 got a "Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>", I didn't add
that because of the above change.
(Hmm, my setup is broken, the b4 patch signature was done before I added this
message. I wonder if this will break the signature ...)
Best regards
Uwe
drivers/char/hw_random/meson-rng.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c
index e446236e81f2..8bb30282ca46 100644
--- a/drivers/char/hw_random/meson-rng.c
+++ b/drivers/char/hw_random/meson-rng.c
@@ -54,9 +54,10 @@ static int meson_rng_probe(struct platform_device *pdev)
if (IS_ERR(data->base))
return PTR_ERR(data->base);
- data->core_clk = devm_clk_get(dev, "core");
+ data->core_clk = devm_clk_get_optional(dev, "core");
if (IS_ERR(data->core_clk))
- data->core_clk = NULL;
+ return dev_err_probe(dev, PTR_ERR(data->core_clk),
+ "Failed to get core clock\n");
if (data->core_clk) {
ret = clk_prepare_enable(data->core_clk);
base-commit: 7d2a07b769330c34b4deabeed939325c77a7ec2f
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2021-09-20 7:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 7:44 Uwe Kleine-König [this message]
2021-09-20 7:44 ` [PATCH v2] hwrng: meson - Improve error handling for core clock Uwe Kleine-König
2021-09-20 7:44 ` Uwe Kleine-König
2021-09-20 8:16 ` Neil Armstrong
2021-09-20 8:16 ` Neil Armstrong
2021-09-20 8:16 ` Neil Armstrong
2021-09-20 20:24 ` Martin Blumenstingl
2021-09-20 20:24 ` Martin Blumenstingl
2021-09-20 20:24 ` Martin Blumenstingl
2021-10-01 6:43 ` Herbert Xu
2021-10-01 6:43 ` Herbert Xu
2021-10-01 6:43 ` Herbert Xu
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=20210920074405.252477-1-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=herbert@gondor.apana.org.au \
--cc=jbrunet@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mpm@selenic.com \
--cc=narmstrong@baylibre.com \
/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.