Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: clk_round_rate() can return a zero upon error

Treat both negative and zero return values from clk_round_rate() as
errors. This is needed since subsequent patches will convert
clk_round_rate()'s return value to be an unsigned type, rather than a
signed type, since some clock sources can generate rates higher than
(2^31)-1 Hz.

Eventually, when calling clk_round_rate(), only a return value of zero
will be considered a error. All other values will be considered valid
rates. The comparison against values less than 0 is kept to preserve
the correct behavior in the meantime.

Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Cc: Arto Merilainen <amerilainen@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Terje Bergström <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Paul Walmsley and committed by
Thierry Reding
23a0e27a 8e0d788c

+1 -1
+1 -1
drivers/gpu/drm/tegra/hdmi.c
··· 960 960 parent = clk_get_parent(hdmi->clk_parent); 961 961 962 962 err = clk_round_rate(parent, pclk * 4); 963 - if (err < 0) 963 + if (err <= 0) 964 964 *status = MODE_NOCLOCK; 965 965 else 966 966 *status = MODE_OK;