All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: guoren <guoren@kernel.org>, "Arnd Bergmann" <arnd@kernel.org>
Cc: "Pavel Machek" <pavel@ucw.cz>, "Lee Jones" <lee@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Palmer Dabbelt" <palmer@rivosinc.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] leds: sun50i-a100: avoid division-by-zero warning
Date: Wed, 13 Dec 2023 07:32:14 +0100	[thread overview]
Message-ID: <42f522b5-6406-4bef-8180-3a431ee884a5@app.fastmail.com> (raw)
In-Reply-To: <CAJF2gTQckdn=uDfeLKu7wceOq7LT1KGJUT0vARMr9zUy3xc4xw@mail.gmail.com>

On Wed, Dec 13, 2023, at 02:26, Guo Ren wrote:
> On Wed, Dec 13, 2023 at 5:45 AM Arnd Bergmann <arnd@kernel.org> wrote:
>>  {
>>         const struct sun50i_a100_ledc_timing *timing = &priv->timing;
>>         unsigned long mod_freq = clk_get_rate(priv->mod_clk);
>> -       u32 cycle_ns = NSEC_PER_SEC / mod_freq;
>> +       u32 cycle_ns;
>>         u32 control;
>>
>> +       if (!mod_freq)
>> +               return;
>> +
> Shall we need err_disable_bus_clk?
>
> + static int sun50i_a100_ledc_set_timing(struct sun50i_a100_ledc *priv)
> - static void sun50i_a100_ledc_set_timing(struct sun50i_a100_ledc *priv)

I'm not worried about it too much, as there is already an error check
on priv->mod_clk being unavailable during initialization. The case that
the warning is about is just for build-testing on architectures that
don't even use COMMON_CLK.

     Arnd

WARNING: multiple messages have this Message-ID (diff)
From: "Arnd Bergmann" <arnd@arndb.de>
To: guoren <guoren@kernel.org>, "Arnd Bergmann" <arnd@kernel.org>
Cc: "Pavel Machek" <pavel@ucw.cz>, "Lee Jones" <lee@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Palmer Dabbelt" <palmer@rivosinc.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] leds: sun50i-a100: avoid division-by-zero warning
Date: Wed, 13 Dec 2023 07:32:14 +0100	[thread overview]
Message-ID: <42f522b5-6406-4bef-8180-3a431ee884a5@app.fastmail.com> (raw)
In-Reply-To: <CAJF2gTQckdn=uDfeLKu7wceOq7LT1KGJUT0vARMr9zUy3xc4xw@mail.gmail.com>

On Wed, Dec 13, 2023, at 02:26, Guo Ren wrote:
> On Wed, Dec 13, 2023 at 5:45 AM Arnd Bergmann <arnd@kernel.org> wrote:
>>  {
>>         const struct sun50i_a100_ledc_timing *timing = &priv->timing;
>>         unsigned long mod_freq = clk_get_rate(priv->mod_clk);
>> -       u32 cycle_ns = NSEC_PER_SEC / mod_freq;
>> +       u32 cycle_ns;
>>         u32 control;
>>
>> +       if (!mod_freq)
>> +               return;
>> +
> Shall we need err_disable_bus_clk?
>
> + static int sun50i_a100_ledc_set_timing(struct sun50i_a100_ledc *priv)
> - static void sun50i_a100_ledc_set_timing(struct sun50i_a100_ledc *priv)

I'm not worried about it too much, as there is already an error check
on priv->mod_clk being unavailable during initialization. The case that
the warning is about is just for build-testing on architectures that
don't even use COMMON_CLK.

     Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-12-13  6:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 21:45 [PATCH] leds: sun50i-a100: avoid division-by-zero warning Arnd Bergmann
2023-12-12 21:45 ` Arnd Bergmann
2023-12-13  1:26 ` Guo Ren
2023-12-13  1:26   ` Guo Ren
2023-12-13  6:32   ` Arnd Bergmann [this message]
2023-12-13  6:32     ` Arnd Bergmann
2023-12-13 14:51     ` Guo Ren
2023-12-13 14:51       ` Guo Ren
2023-12-13 16:16 ` (subset) " Lee Jones
2023-12-13 16:16   ` Lee Jones

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=42f522b5-6406-4bef-8180-3a431ee884a5@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=guoren@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=justinstitt@google.com \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=palmer@rivosinc.com \
    --cc=pavel@ucw.cz \
    --cc=samuel@sholland.org \
    --cc=wens@csie.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 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.