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:
Bastien Nocera 2018-12-12 16:30:26 +01:00
parent b54514df6e
commit ce856efa25

View file

@ -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;