From d1040ccec3d9ad135e5a5090c67fb520cbb80b2a Mon Sep 17 00:00:00 2001 From: Santosh Mardi Date: Wed, 17 Mar 2021 18:29:39 +0530 Subject: [PATCH] drivers: soc: qcom: rimps_memlat: add NULL check for vendor ops Vendor ops will remain NULL in case of SCMI failures during initialization. Update store min and max functions to check for NULL before accessing vendor ops structure. Change-Id: I5a93a7161d8d01510f7d580c25e268fdc113df6b Signed-off-by: Santosh Mardi --- drivers/soc/qcom/rimps_memlat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soc/qcom/rimps_memlat.c b/drivers/soc/qcom/rimps_memlat.c index d517a4df3221..e38e28db3c57 100644 --- a/drivers/soc/qcom/rimps_memlat.c +++ b/drivers/soc/qcom/rimps_memlat.c @@ -252,6 +252,9 @@ static ssize_t store_min_freq(struct kobject *kobj, unsigned int min_freq; unsigned int max_freq; + if (!ops) + return -ENODEV; + if (mon->mon_type == L3_MEMLAT) { min_freq = l3_freqs[0]; max_freq = l3_freqs[l3_pstates]; @@ -291,6 +294,9 @@ static ssize_t store_max_freq(struct kobject *kobj, unsigned int min_freq; unsigned int max_freq; + if (!ops) + return -ENODEV; + if (mon->mon_type == L3_MEMLAT) { min_freq = l3_freqs[0]; max_freq = l3_freqs[l3_pstates];