Commit d94a2edd authored by Roel Kluin's avatar Roel Kluin Committed by Tony Lindgren

ARM: OMAP2: possible division by 0

In linus' git tree the functions can be found at:
vi arch/arm/mach-omap2/usb-tusb6010.c +200	- tusb6010_platform_retime()
vi arch/arm/mach-omap2/gpmc.c +94		- gpmc_get_fclk_period()
vi arch/arm/mach-omap2/usb-tusb6010.c +53	- tusb_set_async_mode()
vi arch/arm/mach-omap2/usb-tusb6010.c +111	- tusb_set_sync_mode()

is -ENODEV appropriate when sysclk_ps == 0?

This was found by code analysis, please review.
------------------------------>8-------------8<---------------------------------
gpmc_get_fclk_period() may return 0 when gpmc_l3_clk is not enabled. This is
not checked in tusb6010_platform_retime() nor in tusb_set_async_mode() it
seems. In tusb_set_sync_mode() this may result in a division by zero.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6b7bff31
...@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk) ...@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk)
unsigned sysclk_ps; unsigned sysclk_ps;
int status; int status;
if (!refclk_psec) if (!refclk_psec || sysclk_ps == 0)
return -ENODEV; return -ENODEV;
sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment