Re: [PATCH] leds: sun50i-a100: avoid division-by-zero warning

From: Guo Ren
Date: Wed Dec 13 2023 - 09:51:31 EST


On Wed, Dec 13, 2023 at 2:32 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Wed, Dec 13, 2023, at 02:26, Guo Ren wrote:
> > On Wed, Dec 13, 2023 at 5:45 AM Arnd Bergmann <arnd@xxxxxxxxxx> 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.
Okay

Reviewed-by: Guo Ren <guoren@xxxxxxxxxx>

>
> Arnd



--
Best Regards
Guo Ren