From 80f8a293cc367cdfff426c9bd71e9844289a1457 Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Wed, 20 Mar 2019 06:25:27 +0800 Subject: [PATCH] hid-sony: fix divide by 0 exception. --- drivers/hid/hid-sony.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index b3722c51e..1ce182bb1 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1121,9 +1121,9 @@ static void dualshock4_parse_report(struct sony_sc *sc, u8 *rd, int size) * Note: we swap numerator 'x' and 'numer' in mult_frac for * precision reasons so we don't need 64-bit. */ - int calib_data = mult_frac(calib->sens_numer, + int calib_data = calib->sens_denom ? mult_frac(calib->sens_numer, raw_data - calib->bias, - calib->sens_denom); + calib->sens_denom) : 0; input_report_abs(sc->sensor_dev, calib->abs_code, calib_data); offset += 2;