Pull power management fixes from Rafael Wysocki: "These fix some issues and clean up code in ARM cpufreq drivers. Specifics: - Fix module loading in the Tegra124 cpufreq driver (Jon Hunter) - Fix memory leak and update to read-only region in the qcom cpufreq driver (Fabien Parent) - Miscellaneous minor cleanups to cpufreq drivers (Fabien Parent, Yang Yingliang)" * tag 'pm-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: sun50i: Switch to use dev_err_probe() helper cpufreq: qcom-nvmem: Switch to use dev_err_probe() helper cpufreq: imx6q: Switch to use dev_err_probe() helper cpufreq: dt: Switch to use dev_err_probe() helper cpufreq: qcom: remove unused parameter in function definition cpufreq: qcom: fix writes in read-only memory region cpufreq: qcom: fix memory leak in error path cpufreq: tegra194: Fix module loading
Unified · Split
| @@ -222,10 +222,8 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu) · 221 unmodified lines | ||
| 222 | 222 | if (reg_name[0]) { |
| 223 | 223 | priv->opp_token = dev_pm_opp_set_regulators(cpu_dev, reg_name); |
| 224 | 224 | if (priv->opp_token < 0) { |
| 225 | − ret = priv->opp_token; | |
| 226 | − if (ret != -EPROBE_DEFER) | |
| 227 | − dev_err(cpu_dev, "failed to set regulators: %d\n", | |
| 228 | − ret); | |
| 225 | + ret = dev_err_probe(cpu_dev, priv->opp_token, | |
| 226 | + "failed to set regulators\n"); | |
| 229 | 227 | goto free_cpumask; |
| 230 | 228 | } |
| 231 | 229 | } |
| @@ -396,9 +396,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) · 395 unmodified lines | ||
| 396 | 396 | ret = imx6q_opp_check_speed_grading(cpu_dev); |
| 397 | 397 | } |
| 398 | 398 | if (ret) { |
| 399 | − if (ret != -EPROBE_DEFER) | |
| 400 | − dev_err(cpu_dev, "failed to read ocotp: %d\n", | |
| 401 | − ret); | |
| 399 | + dev_err_probe(cpu_dev, ret, "failed to read ocotp\n"); | |
| 402 | 400 | goto out_free_opp; |
| 403 | 401 | } |
| 404 | 402 | |
| @@ -64,7 +64,7 @@ static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev; · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | static void get_krait_bin_format_a(struct device *cpu_dev, |
| 66 | 66 | int *speed, int *pvs, int *pvs_ver, |
| 67 | − struct nvmem_cell *pvs_nvmem, u8 *buf) | |
| 67 | + u8 *buf) | |
| 68 | 68 | { |
| 69 | 69 | u32 pte_efuse; |
| 70 | 70 | |
| @@ -95,7 +95,7 @@ static void get_krait_bin_format_a(struct device *cpu_dev, · 24 unmodified lines | ||
| 95 | 95 | |
| 96 | 96 | static void get_krait_bin_format_b(struct device *cpu_dev, |
| 97 | 97 | int *speed, int *pvs, int *pvs_ver, |
| 98 | − struct nvmem_cell *pvs_nvmem, u8 *buf) | |
| 98 | + u8 *buf) | |
| 99 | 99 | { |
| 100 | 100 | u32 pte_efuse, redundant_sel; |
| 101 | 101 | |
| @@ -213,6 +213,7 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, · 111 unmodified lines | ||
| 213 | 213 | int speed = 0, pvs = 0, pvs_ver = 0; |
| 214 | 214 | u8 *speedbin; |
| 215 | 215 | size_t len; |
| 216 | + int ret = 0; | |
| 216 | 217 | |
| 217 | 218 | speedbin = nvmem_cell_read(speedbin_nvmem, &len); |
| 218 | 219 | |
| @@ -222,15 +223,16 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, · 3 unmodified lines | ||
| 222 | 223 | switch (len) { |
| 223 | 224 | case 4: |
| 224 | 225 | get_krait_bin_format_a(cpu_dev, &speed, &pvs, &pvs_ver, |
| 225 | − speedbin_nvmem, speedbin); | |
| 226 | + speedbin); | |
| 226 | 227 | break; |
| 227 | 228 | case 8: |
| 228 | 229 | get_krait_bin_format_b(cpu_dev, &speed, &pvs, &pvs_ver, |
| 229 | − speedbin_nvmem, speedbin); | |
| 230 | + speedbin); | |
| 230 | 231 | break; |
| 231 | 232 | default: |
| 232 | 233 | dev_err(cpu_dev, "Unable to read nvmem data. Defaulting to 0!\n"); |
| 233 | − return -ENODEV; | |
| 234 | + ret = -ENODEV; | |
| 235 | + goto len_error; | |
| 234 | 236 | } |
| 235 | 237 | |
| 236 | 238 | snprintf(*pvs_name, sizeof("speedXX-pvsXX-vXX"), "speed%d-pvs%d-v%d", |
| @@ -238,8 +240,9 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, · 1 unmodified line | ||
| 238 | 240 | |
| 239 | 241 | drv->versions = (1 << speed); |
| 240 | 242 | |
| 243 | +len_error: | |
| 241 | 244 | kfree(speedbin); |
| 242 | − return 0; | |
| 245 | + return ret; | |
| 243 | 246 | } |
| 244 | 247 | |
| 245 | 248 | static const struct qcom_cpufreq_match_data match_data_kryo = { |
| @@ -262,7 +265,8 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) · 16 unmodified lines | ||
| 262 | 265 | struct nvmem_cell *speedbin_nvmem; |
| 263 | 266 | struct device_node *np; |
| 264 | 267 | struct device *cpu_dev; |
| 265 | − char *pvs_name = "speedXX-pvsXX-vXX"; | |
| 268 | + char pvs_name_buffer[] = "speedXX-pvsXX-vXX"; | |
| 269 | + char *pvs_name = pvs_name_buffer; | |
| 266 | 270 | unsigned cpu; |
| 267 | 271 | const struct of_device_id *match; |
| 268 | 272 | int ret; |
| @@ -295,11 +299,8 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) · 26 unmodified lines | ||
| 295 | 299 | if (drv->data->get_version) { |
| 296 | 300 | speedbin_nvmem = of_nvmem_cell_get(np, NULL); |
| 297 | 301 | if (IS_ERR(speedbin_nvmem)) { |
| 298 | − if (PTR_ERR(speedbin_nvmem) != -EPROBE_DEFER) | |
| 299 | − dev_err(cpu_dev, | |
| 300 | − "Could not get nvmem cell: %ld\n", | |
| 301 | − PTR_ERR(speedbin_nvmem)); | |
| 302 | − ret = PTR_ERR(speedbin_nvmem); | |
| 302 | + ret = dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), | |
| 303 | + "Could not get nvmem cell\n"); | |
| 303 | 304 | goto free_drv; |
| 304 | 305 | } |
| 305 | 306 | |
| @@ -56,12 +56,9 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | speedbin_nvmem = of_nvmem_cell_get(np, NULL); |
| 58 | 58 | of_node_put(np); |
| 59 | − if (IS_ERR(speedbin_nvmem)) { | |
| 60 | − if (PTR_ERR(speedbin_nvmem) != -EPROBE_DEFER) | |
| 61 | − pr_err("Could not get nvmem cell: %ld\n", | |
| 62 | − PTR_ERR(speedbin_nvmem)); | |
| 63 | − return PTR_ERR(speedbin_nvmem); | |
| 64 | − } | |
| 59 | + if (IS_ERR(speedbin_nvmem)) | |
| 60 | + return dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), | |
| 61 | + "Could not get nvmem cell\n"); | |
| 65 | 62 | |
| 66 | 63 | speedbin = nvmem_cell_read(speedbin_nvmem, &len); |
| 67 | 64 | nvmem_cell_put(speedbin_nvmem); |
| @@ -589,6 +589,7 @@ static const struct of_device_id tegra194_cpufreq_of_match[] = { · 588 unmodified lines | ||
| 589 | 589 | { .compatible = "nvidia,tegra239-ccplex-cluster", .data = &tegra239_cpufreq_soc }, |
| 590 | 590 | { /* sentinel */ } |
| 591 | 591 | }; |
| 592 | +MODULE_DEVICE_TABLE(of, tegra194_cpufreq_of_match); | |
| 592 | 593 | |
| 593 | 594 | static struct platform_driver tegra194_ccplex_driver = { |
| 594 | 595 | .driver = { |