Skip to content

Commit

Permalink
bcm2835-camera: Fix timestamp calculation problem
Browse files Browse the repository at this point in the history
Use div_s64_rem() to convert usec timestamp to timeval
to avoid integer signedness bug.
  • Loading branch information
buddydvd authored Sep 29, 2017
1 parent 7dc3bd0 commit 3192ba6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/platform/bcm2835/bcm2835-camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
struct timeval timestamp;
s64 runtime_us = pts -
dev->capture.vc_start_timestamp;
u32 div = 0;
u32 rem = 0;
s64 div = 0;
s32 rem = 0;

div =
div_u64_rem(runtime_us, USEC_PER_SEC, &rem);
div_s64_rem(runtime_us, USEC_PER_SEC, &rem);
timestamp.tv_sec =
dev->capture.kernel_start_ts.tv_sec + div;
timestamp.tv_usec =
Expand Down

0 comments on commit 3192ba6

Please sign in to comment.