Commit ce856efa authored by Bastien Nocera's avatar Bastien Nocera

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;
        ~~~~~~~~^~~~~~~~~~~~~
parent b54514df
......@@ -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;
......
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