f_mtp:Fix ptp kernel panic in factory mode
authora17671 <a17671@motorola.com>
Fri, 1 Feb 2019 05:19:09 +0000 (13:19 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:56 +0000 (17:36 +0800)
commit2f5be5bc6df9db9a6d2cc7f356184b9dcbcfe84f
tree88758b9cdba54867803d81264c3d19984e507dce
parent668a6d0fba04689fac96233fc08097f310f2c0a5
f_mtp:Fix ptp kernel panic in factory mode

cdev could be null in the switching
PTP case, check the state before reading
To fix the panic issue

Change-Id: I30471023a72457854140ae867ed3977fba834dc0
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/1303922
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
drivers/usb/gadget/function/f_mtp.c