misc: tegra-throughput: prevent division by 0
Ilan Aelion [Thu, 2 Aug 2012 17:01:02 +0000 (11:01 -0600)]
Prevent division by 0 on subsequent flip notifications at an interval
shorter than 1 micro-second.

Bug 1027664

Change-Id: I6e2f886721216fc2479adc1a24504b707c7ebe45
Signed-off-by: Ilan Aelion <iaelion@nvidia.com>
(cherry picked from commit 92807179cbbd60be67e09ff40bdaab313e3a55fe)
Reviewed-on: http://git-master/r/121142
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Michael I Gold <gold@nvidia.com>

drivers/misc/tegra-throughput.c

index fb5f4c0..2ab0e51 100644 (file)
@@ -58,6 +58,9 @@ static int throughput_flip_notifier(struct notifier_block *nb,
                        else
                                last_frame_time = (unsigned short) timediff;
 
+                       if (last_frame_time == 0)
+                               return NOTIFY_DONE;
+
                        throughput_hint =
                                ((int) target_frame_time * 100)/last_frame_time;