From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: George Stark <gnstark@salutedevices.com>
Cc: neil.armstrong@linaro.org, khilman@baylibre.com,
jbrunet@baylibre.com, martin.blumenstingl@googlemail.com,
thierry.reding@gmail.com, hkallweit1@gmail.com,
linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel@salutedevices.com,
Dmitry Rokosov <ddrokosov@salutedevices.com>
Subject: Re: [PATCH 2/2] pwm: meson: add check for error from clk_round_rate()
Date: Wed, 24 Apr 2024 09:13:23 +0200 [thread overview]
Message-ID: <egrt5wtiulo7ovnxkgyxaaopyfbwsnmy6ire26vukj6kyaiuki@gkzflkoxmjwb> (raw)
In-Reply-To: <20240423161356.2522636-3-gnstark@salutedevices.com>
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]
Hello,
On Tue, Apr 23, 2024 at 07:13:56PM +0300, George Stark wrote:
> clk_round_rate() can return not only zero if requested frequency can not
> be provided but also negative error code so add check for it too.
>
> Fixes: 329db102a26d ("pwm: meson: make full use of common clock framework")
> Signed-off-by: George Stark <gnstark@salutedevices.com>
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> ---
> drivers/pwm/pwm-meson.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index ebe76298f6e2..52604635b31e 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -168,9 +168,10 @@ static int meson_pwm_calc(struct pwm_chip *chip, struct pwm_device *pwm,
> freq = ULONG_MAX;
>
> fin_freq = clk_round_rate(channel->clk, freq);
> - if (fin_freq == 0) {
> - dev_err(pwmchip_parent(chip), "invalid source clock frequency\n");
> - return -EINVAL;
> + if (fin_freq <= 0) {
fin_freq is an unsigned long, so your change doesn't have the intended
effect.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2024-04-24 7:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 16:13 [PATCH 0/2] meson pwm small fixes George Stark
2024-04-23 16:13 ` [PATCH 1/2] pwm: meson: drop unneeded check in get_state callback George Stark
2024-04-24 7:19 ` Uwe Kleine-König
2024-04-24 7:57 ` George Stark
2024-04-23 16:13 ` [PATCH 2/2] pwm: meson: add check for error from clk_round_rate() George Stark
2024-04-24 7:13 ` Uwe Kleine-König [this message]
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=egrt5wtiulo7ovnxkgyxaaopyfbwsnmy6ire26vukj6kyaiuki@gkzflkoxmjwb \
--to=u.kleine-koenig@pengutronix.de \
--cc=ddrokosov@salutedevices.com \
--cc=gnstark@salutedevices.com \
--cc=hkallweit1@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=kernel@salutedevices.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=thierry.reding@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).