diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 49e09c641b1c..96863da68b5b 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1783,11 +1783,11 @@ static bool regulators_left_on(struct kgsl_device *device) if (gmu_core_gpmu_isenabled(device)) return false; - if (!IS_ERR(pwr->cx_gdsc)) + if (!IS_ERR_OR_NULL(pwr->cx_gdsc)) if (regulator_is_enabled(pwr->cx_gdsc)) return true; - if (!IS_ERR(pwr->gx_gdsc)) + if (!IS_ERR_OR_NULL(pwr->gx_gdsc)) return regulator_is_enabled(pwr->gx_gdsc); return false; diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c index cb2335a93276..692451e863b3 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.c +++ b/drivers/gpu/msm/kgsl_pwrctrl.c @@ -1305,7 +1305,7 @@ static int enable_regulator(struct device *dev, struct regulator *regulator, { int ret; - if (IS_ERR(regulator)) + if (IS_ERR_OR_NULL(regulator)) return 0; ret = regulator_enable(regulator); @@ -1547,8 +1547,11 @@ int kgsl_pwrctrl_init(struct kgsl_device *device) _isense_clk_set_rate(pwr, pwr->num_pwrlevels - 1); - pwr->cx_gdsc = devm_regulator_get(&pdev->dev, "vddcx"); - pwr->gx_gdsc = devm_regulator_get(&pdev->dev, "vdd"); + if (of_property_read_bool(pdev->dev.of_node, "vddcx-supply")) + pwr->cx_gdsc = devm_regulator_get(&pdev->dev, "vddcx"); + + if (of_property_read_bool(pdev->dev.of_node, "vdd-supply")) + pwr->gx_gdsc = devm_regulator_get(&pdev->dev, "vdd"); pwr->power_flags = 0; diff --git a/drivers/gpu/msm/kgsl_util.c b/drivers/gpu/msm/kgsl_util.c index fbee7a5ace33..d7ddc602f0d4 100644 --- a/drivers/gpu/msm/kgsl_util.c +++ b/drivers/gpu/msm/kgsl_util.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. */ @@ -17,6 +17,9 @@ bool kgsl_regulator_disable_wait(struct regulator *reg, u32 timeout) { ktime_t tout = ktime_add_us(ktime_get(), timeout * 1000); + if (IS_ERR_OR_NULL(reg)) + return true; + regulator_disable(reg); for (;;) {