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

Guo Ren guoren at kernel.org
Wed Dec 13 06:51:12 PST 2023


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

Reviewed-by: Guo Ren <guoren at kernel.org>

>
>      Arnd



-- 
Best Regards
 Guo Ren



More information about the linux-arm-kernel mailing list