usb: f_mtp: Check number of iterations before division
If no MTP transfers have taken place and the user checks
MTP status using
cat /sys/kernel/debug/usb_mtp/status
Then number of iterations will be 0 and a division by
0 (sum/iteration) would happen in debug_mtp_read_stats
resulting in device crash. Fix this by checking if
num of iterations is >0 and only then division; else 0.
Change-Id: I87ba6daac04d1dfb90409f1a2da15e6659976926
Signed-off-by:
Ajay Agarwal <ajaya@codeaurora.org>
Loading
Please register or sign in to comment