From 11664d82f8cb24cd47fe7e50577eef11084a41af Mon Sep 17 00:00:00 2001 From: liujg6 Date: Sun, 24 Apr 2022 10:11:52 +0800 Subject: [PATCH] fix random crashes due to floating point operation Unprotected floating point operation in kernel might corrupt NEON register and cause many random native crashes. Add kernel_neon_begin and kenrel_neon_end to protect floating point operation in wt6670f module. Change-Id: I2a3a4a3ac1ce78513211ca669eb25c808653f0cc Reviewed-on: https://gerrit.mot.com/2251071 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Wang Wang Submit-Approved: Jira Key --- drivers/power/mmi_qc3p_wt6670f/wt6670f_qc3p.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/mmi_qc3p_wt6670f/wt6670f_qc3p.c b/drivers/power/mmi_qc3p_wt6670f/wt6670f_qc3p.c index 3961b7a30ba8..04daadfebcb9 100644 --- a/drivers/power/mmi_qc3p_wt6670f/wt6670f_qc3p.c +++ b/drivers/power/mmi_qc3p_wt6670f/wt6670f_qc3p.c @@ -20,6 +20,7 @@ #include "wt6670f.h" #include #include +#include #define MAX_USER_STR 1024 @@ -154,7 +155,10 @@ static u16 wt6670f_get_vbus_voltage(void) pr_err(">>>>>>wt6670f get vbus voltage = %04x %02x %02x\n", tmp, data[0], data[1]); - return (u16)(tmp * 18.98); + kernel_neon_begin(); + tmp = (u16)(tmp * 18.98); + kernel_neon_end(); + return tmp; } static u16 wt6670f_get_id(u8 reg)