summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDhaval Patel <pdhaval@codeaurora.org>2016-10-14 10:21:29 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-10-14 10:21:29 -0700
commit1fb23d7ae1eb4e6a40acf13fa8b713ff95a77e36 (patch)
tree52f8f10a503003904c5348df924ae5d2a2645d68 /drivers/gpu
parent5d2ce55a38ef9f426323bef7980a2db794f14935 (diff)
parent46027c0246a24f10ca0692ac517601948dbd1c4b (diff)
Merge "drm/msm: fix power handle APIs when clk are not present" into dev/msm-4.4-drm_kms
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/sde_power_handle.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/gpu/drm/msm/sde_power_handle.c b/drivers/gpu/drm/msm/sde_power_handle.c
index cd5ee07d0cdc..c1a7d9226fb3 100644
--- a/drivers/gpu/drm/msm/sde_power_handle.c
+++ b/drivers/gpu/drm/msm/sde_power_handle.c
@@ -90,7 +90,7 @@ static int sde_power_parse_dt_supply(struct platform_device *pdev,
supply_root_node = of_get_child_by_name(of_node,
"qcom,platform-supply-entries");
if (!supply_root_node) {
- pr_err("no supply entry present\n");
+ pr_debug("no supply entry present\n");
return rc;
}
@@ -222,28 +222,31 @@ static int sde_power_parse_dt_clock(struct platform_device *pdev,
const char *clock_name;
u32 clock_rate;
u32 clock_max_rate;
+ int num_clk;
if (!pdev || !mp) {
pr_err("invalid input param pdev:%pK mp:%pK\n", pdev, mp);
return -EINVAL;
}
- mp->num_clk = of_property_count_strings(pdev->dev.of_node,
+ mp->num_clk = 0;
+ num_clk = of_property_count_strings(pdev->dev.of_node,
"clock-names");
- if (mp->num_clk <= 0) {
- pr_err("clocks are not defined\n");
+ if (num_clk <= 0) {
+ pr_debug("clocks are not defined\n");
goto clk_err;
}
+ mp->num_clk = num_clk;
mp->clk_config = devm_kzalloc(&pdev->dev,
- sizeof(struct dss_clk) * mp->num_clk, GFP_KERNEL);
+ sizeof(struct dss_clk) * num_clk, GFP_KERNEL);
if (!mp->clk_config) {
rc = -ENOMEM;
mp->num_clk = 0;
goto clk_err;
}
- for (i = 0; i < mp->num_clk; i++) {
+ for (i = 0; i < num_clk; i++) {
of_property_read_string_index(pdev->dev.of_node, "clock-names",
i, &clock_name);
strlcpy(mp->clk_config[i].clk_name, clock_name,
@@ -407,7 +410,7 @@ void sde_power_resource_deinit(struct platform_device *pdev,
{
struct dss_module_power *mp;
- if (!phandle) {
+ if (!phandle || !pdev) {
pr_err("invalid input param\n");
return;
}
@@ -419,8 +422,12 @@ void sde_power_resource_deinit(struct platform_device *pdev,
msm_dss_config_vreg(&pdev->dev, mp->vreg_config, mp->num_vreg, 0);
- devm_kfree(&pdev->dev, mp->clk_config);
- devm_kfree(&pdev->dev, mp->vreg_config);
+ if (mp->clk_config)
+ devm_kfree(&pdev->dev, mp->clk_config);
+
+ if (mp->vreg_config)
+ devm_kfree(&pdev->dev, mp->vreg_config);
+
mp->num_vreg = 0;
mp->num_clk = 0;
}