Merge "clk: qcom: Fix uninitialized variable and null pointer exception"

This commit is contained in:
Linux Build Service Account 2017-01-28 00:47:03 -08:00 committed by Gerrit - the friendly Code Review server
commit 863cfcb4fd
2 changed files with 18 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2013, 2016-2017, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -275,6 +275,8 @@ static int clk_branch2_hw_ctl_determine_rate(struct clk_hw *hw,
struct clk_hw *clkp;
clkp = __clk_get_hw(clk_get_parent(hw->clk));
if (!clkp)
return -EINVAL;
req->best_parent_hw = clkp;
req->best_parent_rate = clk_round_rate(clkp->clk, req->rate);

View file

@ -1512,7 +1512,7 @@ static int clk_osm_setup_hw_table(struct clk_osm *c)
{
struct osm_entry *entry = c->osm_table;
int i;
u32 freq_val, volt_val, override_val, spare_val;
u32 freq_val = 0, volt_val = 0, override_val = 0, spare_val = 0;
u32 table_entry_offset, last_spare, last_virtual_corner = 0;
for (i = 0; i < OSM_TABLE_SIZE; i++) {
@ -2472,14 +2472,19 @@ static u64 clk_osm_get_cpu_cycle_counter(int cpu)
static void populate_opp_table(struct platform_device *pdev)
{
int cpu;
struct device *cpu_dev;
for_each_possible_cpu(cpu) {
if (logical_cpu_to_clk(cpu) == pwrcl_clk.hw.clk) {
WARN(add_opp(&pwrcl_clk, get_cpu_device(cpu)),
cpu_dev = get_cpu_device(cpu);
if (cpu_dev)
WARN(add_opp(&pwrcl_clk, cpu_dev),
"Failed to add OPP levels for power cluster\n");
}
if (logical_cpu_to_clk(cpu) == perfcl_clk.hw.clk) {
WARN(add_opp(&perfcl_clk, get_cpu_device(cpu)),
cpu_dev = get_cpu_device(cpu);
if (cpu_dev)
WARN(add_opp(&perfcl_clk, cpu_dev),
"Failed to add OPP levels for perf cluster\n");
}
}
@ -2543,7 +2548,7 @@ static ssize_t debugfs_trace_method_set(struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
{
struct clk_osm *c = file->private_data;
struct clk_osm *c;
u32 val;
if (IS_ERR(file) || file == NULL) {
@ -2551,6 +2556,8 @@ static ssize_t debugfs_trace_method_set(struct file *file,
return -EINVAL;
}
c = file->private_data;
if (!c) {
pr_err("invalid clk_osm handle\n");
return -EINVAL;
@ -2593,7 +2600,7 @@ static ssize_t debugfs_trace_method_set(struct file *file,
static ssize_t debugfs_trace_method_get(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct clk_osm *c = file->private_data;
struct clk_osm *c;
int len, rc;
if (IS_ERR(file) || file == NULL) {
@ -2601,6 +2608,8 @@ static ssize_t debugfs_trace_method_get(struct file *file, char __user *buf,
return -EINVAL;
}
c = file->private_data;
if (!c) {
pr_err("invalid clk_osm handle\n");
return -EINVAL;
@ -3023,7 +3032,7 @@ static unsigned long perfcl_boot_rate = 1747200000;
static int clk_cpu_osm_driver_probe(struct platform_device *pdev)
{
int rc, cpu, i;
int rc = 0, cpu, i;
int speedbin = 0, pvs_ver = 0;
u32 pte_efuse;
int num_clks = ARRAY_SIZE(osm_qcom_clk_hws);