Skip to content

Commit 66aeb0e

Browse files
weivincewangAkash98Sky
authored andcommitted
ANDROID: fix uninitilized variable
Currently we set CONFIG_CC_OPTIMIZE_FOR_SIZE which suppressed the compiler warning of unused variables which can lead undefined behavior e.g. memory corruption and panic. See https://lkml.org/lkml/2013/3/25/347. This patch fixes all the uninitilized variables in kernel Bug: 33353384 Test: On device Signed-off-by: Wei Wang <[email protected]> Change-Id: I0ae1082f447b435d71156d471878ba71aa16c378
1 parent 065d9c6 commit 66aeb0e

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

drivers/clk/qcom/clock-cpu-8994.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,8 @@ void sanity_check_clock_tree(u32 muxval, struct mux_clk *mux)
987987
case AUX_CLK_SEL:
988988
rate = sys_apcsaux_clk.c.rate;
989989
break;
990+
default:
991+
return;
990992
};
991993
break;
992994
case PLL0_EARLY_SEL:
@@ -997,6 +999,8 @@ void sanity_check_clock_tree(u32 muxval, struct mux_clk *mux)
997999
rate = readl_relaxed(base + C0_PLLA_L_VAL);
9981000
rate *= xo_ao.c.rate;
9991001
break;
1002+
default:
1003+
return;
10001004
};
10011005

10021006
/* One regulator */
@@ -1556,7 +1560,7 @@ static void populate_opp_table(struct platform_device *pdev)
15561560
struct platform_device *apc0_dev, *apc1_dev;
15571561
struct device_node *apc0_node, *apc1_node;
15581562
unsigned long apc0_fmax, apc1_fmax;
1559-
int cpu, a53_cpu, a57_cpu;
1563+
int cpu, a53_cpu = 0, a57_cpu = 0;
15601564

15611565
apc0_node = of_parse_phandle(pdev->dev.of_node, "vdd-a53-supply", 0);
15621566
apc1_node = of_parse_phandle(pdev->dev.of_node, "vdd-a57-supply", 0);
@@ -1957,7 +1961,6 @@ static int cpu_clock_8994_driver_probe(struct platform_device *pdev)
19571961
u64 pte_efuse;
19581962
char a57speedbinstr[] = "qcom,a57-speedbinXX-vXX";
19591963
char a53speedbinstr[] = "qcom,a53-speedbinXX-vXX";
1960-
19611964
v2 = msm8994_v2 | msm8992;
19621965

19631966
a53_pll0_main.c.flags = CLKFLAG_NO_RATE_CACHE;
@@ -1984,7 +1987,7 @@ static int cpu_clock_8994_driver_probe(struct platform_device *pdev)
19841987

19851988
snprintf(a53speedbinstr, ARRAY_SIZE(a53speedbinstr),
19861989
"qcom,a53-speedbin%d-v%d", a53speedbin, pvs_ver);
1987-
} else if (v2)
1990+
} else
19881991
pte_efuse = readl_relaxed(vbases[EFUSE_BASE]);
19891992

19901993
snprintf(a53speedbinstr, ARRAY_SIZE(a53speedbinstr),

drivers/cpufreq/cpufreq_stats.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ void cpufreq_task_stats_remove_uids(uid_t uid_start, uid_t uid_end)
838838
static int cpufreq_stat_notifier_policy(struct notifier_block *nb,
839839
unsigned long val, void *data)
840840
{
841-
int ret, count = 0, i;
841+
int ret = 0, count = 0, i;
842842
struct cpufreq_policy *policy = data;
843843
struct cpufreq_frequency_table *table;
844844
unsigned int cpu = policy->cpu;

drivers/input/touchscreen/synaptics_fw_update.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,7 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
23792379
fwu->ts_info = kzalloc(RMI4_INFO_MAX_LEN, GFP_KERNEL);
23802380
if (!fwu->ts_info) {
23812381
dev_err(&rmi4_data->i2c_client->dev, "Not enough memory\n");
2382-
goto exit_free_ts_info;
2382+
goto exit_free_mem;
23832383
}
23842384

23852385
synaptics_rmi4_update_debug_info();
@@ -2393,7 +2393,6 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
23932393
#endif
23942394

23952395
return 0;
2396-
exit_free_ts_info:
23972396
debugfs_remove(temp);
23982397
exit_remove_attrs:
23992398
for (attr_count--; attr_count >= 0; attr_count--) {

drivers/power/qcom/debug_core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ int msm_core_debug_init(void)
290290

291291
msm_core_data = get_cpu_pwr_stats();
292292
if (!msm_core_data)
293-
goto fail;
293+
return PTR_ERR(NULL);
294294

295295
dir = debugfs_create_dir("msm_core", NULL);
296296
if (IS_ERR_OR_NULL(dir))

drivers/power/qcom/msm-core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ static int update_userspace_power(struct sched_params __user *argp)
354354
{
355355
int i;
356356
int ret;
357-
int cpu;
358357
struct cpu_activity_info *node;
359358
struct cpu_static_info *sp, *clear_sp;
360359
int cpumask, cluster, mpidr;
360+
int cpu = num_possible_cpus();
361361

362362
get_user(cpumask, &argp->cpumask);
363363
get_user(cluster, &argp->cluster);

drivers/power/qpnp-fg.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5041,6 +5041,7 @@ static int fg_batt_profile_init(struct fg_chip *chip)
50415041
const char *data, *batt_type_str, *old_batt_type;
50425042
bool tried_again = false, vbat_in_range, profiles_same;
50435043
u8 reg = 0;
5044+
old_batt_type = default_batt_type;
50445045

50455046
wait:
50465047
fg_stay_awake(&chip->profile_wakeup_source);
@@ -5068,7 +5069,6 @@ static int fg_batt_profile_init(struct fg_chip *chip)
50685069
fg_batt_type);
50695070
if (!profile_node) {
50705071
pr_err("couldn't find profile handle\n");
5071-
old_batt_type = default_batt_type;
50725072
rc = -ENODATA;
50735073
goto fail;
50745074
}

drivers/power/qpnp-smbcharger.c

+2
Original file line numberDiff line numberDiff line change
@@ -7883,6 +7883,8 @@ static int smbchg_probe(struct spmi_device *spmi)
78837883
rc);
78847884
return rc;
78857885
}
7886+
} else {
7887+
vadc_dev = NULL;
78867888
}
78877889

78887890
if (of_find_property(spmi->dev.of_node, "qcom,vchg_sns-vadc", NULL)) {

drivers/soc/qcom/npa-dump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int npa_dump_probe(struct platform_device *pdev)
155155
struct resource *res;
156156
void __iomem *npa_base, *rpm_base;
157157
struct dentry *dent;
158-
int ret;
158+
int ret = 0;
159159

160160
/* Get the location of the NPA log's start address offset */
161161
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

drivers/video/msm/mdss/mdss_mdp_intf_cmd.c

-1
Original file line numberDiff line numberDiff line change
@@ -1646,4 +1646,3 @@ int mdss_mdp_cmd_start(struct mdss_mdp_ctl *ctl)
16461646

16471647
return 0;
16481648
}
1649-

sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -4097,10 +4097,10 @@ static int msm_routing_put_stereo_to_custom_stereo_control(
40974097
int flag = 0, i = 0, rc = 0, idx = 0;
40984098
int be_index = 0, port_id, topo_id;
40994099
unsigned int session_id = 0;
4100-
uint16_t op_FL_ip_FL_weight;
4101-
uint16_t op_FL_ip_FR_weight;
4102-
uint16_t op_FR_ip_FL_weight;
4103-
uint16_t op_FR_ip_FR_weight;
4100+
uint16_t op_FL_ip_FL_weight = 0;
4101+
uint16_t op_FL_ip_FR_weight = 0;
4102+
uint16_t op_FR_ip_FL_weight = 0;
4103+
uint16_t op_FR_ip_FR_weight = 0;
41044104
flag = ucontrol->value.integer.value[0];
41054105
pr_debug("%s E flag %d\n", __func__, flag);
41064106

0 commit comments

Comments
 (0)