Skip to content
  • Marek Vasut's avatar
    clk: vc5: Prevent division by zero on unconfigured outputs · 3bded569
    Marek Vasut authored
    
    
    In case the initial values of the FOD registers are not configured in
    the OTP or by the bootloader, it is possible that the FOD registers
    will contain zeroes. The code in vc5_fod_recalc_rate() immediately
    feeds the FOD divider value obtained from the FOD registers into the
    div64_u64() and if the FOD divider value is zero, triggers division
    by zero exception.
    
    Check if the FOD divider value is zero and return the frequency of
    the FOD output as 0 Hz if it is so. This prevents the division by
    zero exception.
    
    Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
    Cc: Stephen Boyd <sboyd@codeaurora.org>
    Cc: Alexey Firago <alexey_firago@mentor.com>
    Cc: Michael Turquette <mturquette@baylibre.com>
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Cc: linux-renesas-soc@vger.kernel.org
    Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # Salvator-XS with the display LVDS output.
    Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    3bded569