elan: Assert on a possible division by zero in elan_need_calibration()
libfprint/drivers/elan.c:598:10: warning: Division by zero bg_mean /= frame_size; ~~~~~~~~^~~~~~~~~~~~~
This commit is contained in:
parent
b54514df6e
commit
ce856efa25
1 changed files with 2 additions and 0 deletions
|
@ -595,6 +595,8 @@ static int elan_need_calibration(struct elan_dev *elandev)
|
|||
unsigned int bg_mean = 0, delta;
|
||||
unsigned int frame_size = elandev->frame_width * elandev->frame_height;
|
||||
|
||||
g_assert(frame_size != 0);
|
||||
|
||||
for (int i = 0; i < frame_size; i++)
|
||||
bg_mean += elandev->background[i];
|
||||
bg_mean /= frame_size;
|
||||
|
|
Loading…
Reference in a new issue