PM: Use %pe to print error pointers symbolically
Subsystems (20)
cover PM: Use %pe to print error pointers symbolically
This patch series is a cleanup for subsystems under power management (linux-pm) that converts several instances of error pointer printing to use the %pe format specifier instead of explicitly casting with PTR_ERR().
Currently, many drivers use PTR_ERR() paired with %ld or %li to print error codes returned as pointers. By switching to %pe and passing the error pointer directly, the logging subsystem will automatically print the symbolic error name (e.g., -ENOMEM, -EPROBE_DEFER) when CONFIG_SYMBOLIC_ERRNAME is enabled, and gracefully fall back to the numeric value otherwise.
This change significantly improves the readability of kernel logs and dmesg traces during debugging, without introducing any functional changes or side effects.
The cleanup has been applied across the following PM subsystems/drivers:
* powercap (intel_rapl_msr, intel_rapl_tpmi)
* thermal (core, cpufreq_cooling, devfreq_cooling, mmio, etc.)
* cpufreq (bmips, cppc, qoriq, s3c64xx)
* devfreq (imx-bus, imx8m-ddrc, mtk-cci)
* power/supply (various battery and charger drivers)
Sumeet Pawnikar (5):
powercap: intel_rapl: Use %pe to print error pointers symbolically
thermal: Use %pe to print error pointers symbolically
cpufreq: Use %pe to print error pointers symbolically
devfreq: Use %pe to print error pointers symbolically
power: Use %pe to print error pointers symbolically
drivers/cpufreq/bmips-cpufreq.c | 4 ++-- drivers/cpufreq/cppc_cpufreq.c | 4 ++-- drivers/cpufreq/qoriq-cpufreq.c | 4 ++-- drivers/cpufreq/s3c64xx-cpufreq.c | 5 ++--- drivers/devfreq/imx-bus.c | 4 ++-- drivers/devfreq/imx8m-ddrc.c | 3 +-- drivers/devfreq/mtk-cci-devfreq.c | 4 ++-- drivers/power/reset/macsmc-reboot.c | 4 ++-- drivers/power/supply/axp20x_battery.c | 4 ++-- drivers/power/supply/cpcap-charger.c | 4 ++-- drivers/power/supply/cw2015_battery.c | 4 ++-- drivers/power/supply/intel_dc_ti_battery.c | 2 +- drivers/power/supply/qcom_smbx.c | 2 +- drivers/powercap/intel_rapl_msr.c | 4 ++-- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- drivers/thermal/cpufreq_cooling.c | 4 ++-- drivers/thermal/devfreq_cooling.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 4 ++-- drivers/thermal/thermal_mmio.c | 3 +-- drivers/thermal/uniphier_thermal.c | 3 +-- 20 files changed, 35 insertions(+), 39 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/5 powercap: intel_rapl: Use %pe to print error pointers symbolically
Replace PTR_ERR() and %ld with %pe and pass the original pointer directly to pr_debug() and dev_err(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
--- drivers/powercap/intel_rapl_msr.c | 4 ++-- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/powercap/intel_rapl_msr.c +2 -2
@@ -582,8 +582,8 @@ static int intel_rapl_msr_init(void) rapl_msr_platdev =platform_device_register_data (NULL ,"intel_rapl_msr" ,0 , def,sizeof (*def));if (IS_ERR (rapl_msr_platdev)) -pr_debug ("intel_rapl_msr device register failed, ret:%ld\n" , -PTR_ERR (rapl_msr_platdev)); +pr_debug ("intel_rapl_msr device register failed, ret:%pe\n" , + rapl_msr_platdev);return 0 ; }
drivers/powercap/intel_rapl_tpmi.c +2 -2
@@ -408,8 +408,8 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, trp->rp =rapl_add_package (info->package_id, &trp->priv, false);if (IS_ERR (trp->rp)) { -dev_err (&auxdev->dev,"Failed to add RAPL Domain for Package%d, %ld\n" , - info->package_id,PTR_ERR (trp->rp)); +dev_err (&auxdev->dev,"Failed to add RAPL Domain for Package%d, %pe\n" , + info->package_id, trp->rp); ret =PTR_ERR (trp->rp); goto err; }
Signature · 1 line
2.43.0
PATCH 2/5 thermal: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarReplace PTR_ERR() and %ld with %pe and pass the original pointer directly to pr_err() and dev_err(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
--- drivers/thermal/cpufreq_cooling.c | 4 ++-- drivers/thermal/devfreq_cooling.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 4 ++-- drivers/thermal/thermal_mmio.c | 3 +-- drivers/thermal/uniphier_thermal.c | 3 +-- 5 files changed, 8 insertions(+), 10 deletions(-)
drivers/thermal/cpufreq_cooling.c +2 -2
@@ -661,8 +661,8 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy) cdev =__cpufreq_cooling_register (np, policy, em);if (IS_ERR (cdev)) { -pr_err ("cpufreq_cooling: cpu%d failed to register as cooling device: %ld\n" , - policy->cpu,PTR_ERR (cdev)); +pr_err ("cpufreq_cooling: cpu%d failed to register as cooling device: %pe\n" , + policy->cpu, cdev); cdev =NULL ; } }
drivers/thermal/devfreq_cooling.c +2 -2
@@ -156,8 +156,8 @@ static unsigned long get_voltage(struct devfreq *df, unsigned long freq) opp =dev_pm_opp_find_freq_exact (dev, freq, false);if (IS_ERR (opp)) { -dev_err_ratelimited (dev,"Failed to find OPP for frequency %lu: %ld\n" , - freq,PTR_ERR (opp)); +dev_err_ratelimited (dev,"Failed to find OPP for frequency %lu: %pe\n" , + freq, opp);return 0 ; }
drivers/thermal/qcom/qcom-spmi-adc-tm5.c +2 -2
@@ -680,8 +680,8 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)continue ; } -dev_err (adc_tm->dev,"Error registering TZ zone for channel %d: %ld\n" , - adc_tm->channels[i].channel,PTR_ERR (tzd)); +dev_err (adc_tm->dev,"Error registering TZ zone for channel %d: %pe\n" , + adc_tm->channels[i].channel, tzd);return PTR_ERR (tzd); } adc_tm->channels[i].tzd = tzd;
drivers/thermal/thermal_mmio.c +1 -2
@@ -71,8 +71,7 @@ static int thermal_mmio_probe(struct platform_device *pdev) &thermal_mmio_ops);if (IS_ERR (thermal_zone)) {dev_err (&pdev->dev, -"failed to register sensor (%ld)\n" , -PTR_ERR (thermal_zone)); +"failed to register sensor (%pe)\n" , thermal_zone);return PTR_ERR (thermal_zone); }
drivers/thermal/uniphier_thermal.c +1 -2
@@ -286,8 +286,7 @@ static int uniphier_tm_probe(struct platform_device *pdev) regmap =syscon_node_to_regmap (parent);of_node_put (parent);if (IS_ERR (regmap)) { -dev_err (dev,"failed to get regmap (error %ld)\n" , -PTR_ERR (regmap)); +dev_err (dev,"failed to get regmap (error %pe)\n" , regmap);return PTR_ERR (regmap); } tdev->regmap = regmap;
Signature · 1 line
2.43.0
PATCH 3/5 cpufreq: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarReplace PTR_ERR() and %ld with %pe and pass the original pointer directly to pr_err() and pr_warn(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
--- drivers/cpufreq/bmips-cpufreq.c | 4 ++-- drivers/cpufreq/cppc_cpufreq.c | 4 ++-- drivers/cpufreq/qoriq-cpufreq.c | 4 ++-- drivers/cpufreq/s3c64xx-cpufreq.c | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-)
drivers/cpufreq/bmips-cpufreq.c +2 -2
@@ -132,8 +132,8 @@ static int bmips_cpufreq_init(struct cpufreq_policy *policy) freq_table =bmips_cpufreq_get_freq_table (policy);if (IS_ERR (freq_table)) { -pr_err ("%s: couldn't determine frequency table (%ld).\n" , -BMIPS_CPUFREQ_NAME ,PTR_ERR (freq_table)); +pr_err ("%s: couldn't determine frequency table (%pe).\n" , +BMIPS_CPUFREQ_NAME , freq_table);return PTR_ERR (freq_table); }
drivers/cpufreq/cppc_cpufreq.c +2 -2
@@ -230,8 +230,8 @@ static void cppc_fie_kworker_init(void) kworker_fie =kthread_run_worker (0 ,"cppc_fie" );if (IS_ERR (kworker_fie)) { -pr_warn ("%s: failed to create kworker_fie: %ld\n" , __func__, -PTR_ERR (kworker_fie)); +pr_warn ("%s: failed to create kworker_fie: %pe\n" , __func__, + kworker_fie); fie_disabled =FIE_DISABLED ; kworker_fie =NULL ;return ;
drivers/cpufreq/qoriq-cpufreq.c +2 -2
@@ -57,8 +57,8 @@ static u32 get_bus_freq(void)/* get platform freq by its clock name */ pltclk =clk_get (NULL ,"cg-pll0-div1" );if (IS_ERR (pltclk)) { -pr_err ("%s: can't get bus frequency %ld\n" , - __func__,PTR_ERR (pltclk)); +pr_err ("%s: can't get bus frequency %pe\n" , + __func__, pltclk);return PTR_ERR (pltclk); }
drivers/cpufreq/s3c64xx-cpufreq.c +2 -3
@@ -152,15 +152,14 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy) policy->clk =clk_get (NULL ,"armclk" );if (IS_ERR (policy->clk)) { -pr_err ("Unable to obtain ARMCLK: %ld\n" , -PTR_ERR (policy->clk)); +pr_err ("Unable to obtain ARMCLK: %pe\n" , policy->clk);return PTR_ERR (policy->clk); }#ifdef CONFIG_REGULATOR vddarm =regulator_get (NULL ,"vddarm" );if (IS_ERR (vddarm)) { -pr_err ("Failed to obtain VDDARM: %ld\n" ,PTR_ERR (vddarm)); +pr_err ("Failed to obtain VDDARM: %pe\n" , vddarm);pr_err ("Only frequency scaling available\n" ); vddarm =NULL ; }else {
Signature · 1 line
2.43.0
PATCH 4/5 devfreq: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarReplace PTR_ERR() and %ld with %pe and pass the original pointer directly to dev_err(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
--- drivers/devfreq/imx-bus.c | 4 ++-- drivers/devfreq/imx8m-ddrc.c | 3 +-- drivers/devfreq/mtk-cci-devfreq.c | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/devfreq/imx-bus.c +2 -2
@@ -75,8 +75,8 @@ static int imx_bus_init_icc(struct device *dev) priv->icc_pdev =platform_device_register_data ( dev, icc_driver_name,-1 ,NULL ,0 );if (IS_ERR (priv->icc_pdev)) { -dev_err (dev,"failed to register icc provider %s: %ld\n" , - icc_driver_name,PTR_ERR (priv->icc_pdev)); +dev_err (dev,"failed to register icc provider %s: %pe\n" , + icc_driver_name, priv->icc_pdev);return PTR_ERR (priv->icc_pdev); }
drivers/devfreq/imx8m-ddrc.c +1 -2
@@ -340,8 +340,7 @@ static int imx8m_ddrc_check_opps(struct device *dev)for (i =0 , freq =0 ; i < opp_count; ++i, ++freq) { opp =dev_pm_opp_find_freq_ceil (dev, &freq);if (IS_ERR (opp)) { -dev_err (dev,"Failed enumerating OPPs: %ld\n" , -PTR_ERR (opp)); +dev_err (dev,"Failed enumerating OPPs: %pe\n" , opp);return PTR_ERR (opp); }dev_pm_opp_put (opp);
drivers/devfreq/mtk-cci-devfreq.c +2 -2
@@ -364,8 +364,8 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) passive_data);if (IS_ERR (drv->devfreq)) { ret = -EPROBE_DEFER ; -dev_err (dev,"failed to add devfreq device: %ld\n" , -PTR_ERR (drv->devfreq)); +dev_err (dev,"failed to add devfreq device: %pe\n" , + drv->devfreq); goto out_remove_opp_table; }
Signature · 1 line
2.43.0
PATCH 5/5 power: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarReplace PTR_ERR() and %ld/%li with %pe and pass the original pointer directly to dev_info(), dev_warn(), dev_err() and dev_dbg(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
--- drivers/power/reset/macsmc-reboot.c | 4 ++-- drivers/power/supply/axp20x_battery.c | 4 ++-- drivers/power/supply/cpcap-charger.c | 4 ++-- drivers/power/supply/cw2015_battery.c | 4 ++-- drivers/power/supply/intel_dc_ti_battery.c | 2 +- drivers/power/supply/qcom_smbx.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-)
drivers/power/reset/macsmc-reboot.c +2 -2
@@ -221,8 +221,8 @@ static int macsmc_reboot_probe(struct platform_device *pdev)if (IS_ERR (cell)) {if (PTR_ERR (cell) == -EPROBE_DEFER )return -EPROBE_DEFER ; -dev_warn (&pdev->dev,"Missing NVMEM cell %s (%ld)\n" , - nvmem_names[i],PTR_ERR (cell)); +dev_warn (&pdev->dev,"Missing NVMEM cell %s (%pe)\n" , + nvmem_names[i], cell);/* Non fatal, we'll deal with it */ cell =NULL ; }
drivers/power/supply/axp20x_battery.c +2 -2
@@ -1123,8 +1123,8 @@ static int axp20x_power_probe(struct platform_device *pdev) axp20x_batt->data->bat_ps_desc, &psy_cfg);if (IS_ERR (axp20x_batt->batt)) { -dev_err (&pdev->dev,"failed to register power supply: %ld\n" , -PTR_ERR (axp20x_batt->batt)); +dev_err (&pdev->dev,"failed to register power supply: %pe\n" , + axp20x_batt->batt);return PTR_ERR (axp20x_batt->batt); }
drivers/power/supply/cpcap-charger.c +2 -2
@@ -808,8 +808,8 @@ static void cpcap_charger_init_optional_gpios(struct cpcap_charger_ddata *ddata) ddata->gpio[i] =devm_gpiod_get_index (ddata->dev,"mode" , i,GPIOD_OUT_HIGH );if (IS_ERR (ddata->gpio[i])) { -dev_info (ddata->dev,"no mode change GPIO%i: %li\n" , - i,PTR_ERR (ddata->gpio[i])); +dev_info (ddata->dev,"no mode change GPIO%i: %pe\n" , + i, ddata->gpio[i]); ddata->gpio[i] =NULL ; } }
drivers/power/supply/cw2015_battery.c +2 -2
@@ -658,8 +658,8 @@ static int cw_bat_probe(struct i2c_client *client) cw_bat->regmap =devm_regmap_init_i2c (client, &cw2015_regmap_config);if (IS_ERR (cw_bat->regmap)) { -dev_err (cw_bat->dev,"Failed to allocate regmap: %ld\n" , -PTR_ERR (cw_bat->regmap)); +dev_err (cw_bat->dev,"Failed to allocate regmap: %pe\n" , + cw_bat->regmap);return PTR_ERR (cw_bat->regmap); }
drivers/power/supply/intel_dc_ti_battery.c +1 -1
@@ -349,7 +349,7 @@ static int dc_ti_battery_probe(struct platform_device *pdev) chip->vbat_channel =devm_iio_channel_get (dev,"VBAT" );if (IS_ERR (chip->vbat_channel)) { -dev_dbg (dev,"devm_iio_channel_get() ret %ld\n" ,PTR_ERR (chip->vbat_channel)); +dev_dbg (dev,"devm_iio_channel_get() ret %pe\n" , chip->vbat_channel);return dev_err_probe (dev, -EPROBE_DEFER ,"Waiting for VBAT IIO channel\n" ); }
drivers/power/supply/qcom_smbx.c +1 -1
@@ -613,7 +613,7 @@ static int smb_get_iio_chan(struct smb_chip *chip, struct iio_channel *chan, }if (IS_ERR (chan)) { -dev_err (chip->dev,"Failed to chan, err = %li" ,PTR_ERR (chan)); +dev_err (chip->dev,"Failed to chan, err = %pe" , chan);return PTR_ERR (chan); }
Signature · 1 line
2.43.0
Krzysztof Kozlowski
maintainerRe: [PATCH 1/5] powercap: intel_rapl: Use %pe to print error pointers symbolically
In reply to Sumeet Pawnikardrivers/powercap/intel_rapl_tpmi.c static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, · line 412
Quoted 6 lines · Sumeet Pawnikar
drivers/powercap/intel_rapl_tpmi.c +2
-2trp->rp =rapl_add_package (info->package_id, &trp->priv, false);if (IS_ERR (trp->rp)) { -dev_err (&auxdev->dev,"Failed to add RAPL Domain for Package%d, %ld\n" , - info->package_id,PTR_ERR (trp->rp)); +dev_err (&auxdev->dev,"Failed to add RAPL Domain for Package%d, %pe\n" , + info->package_id, trp->rp);
Instead you should use dev_err_probe and drop the last argument.
Best regards,
Krzysztof
[email protected]
AI reviewRe: [PATCH 4/5] devfreq: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Mixing devm-managed devfreq devices with manual resource cleanup creates a Use-After-Free window where the devfreq governor remains active. --
commit 1c53c8340b588403af3236e1cac077099e3f1d6f
Author: Sumeet Pawnikar <[email protected]>
devfreq: Use %pe to print error pointers symbolically
This commit replaces PTR_ERR() and %ld with the %pe format specifier for printing error pointers in several devfreq drivers. It allows dev_err() to print symbolic error names when enabled, falling back to the raw integer value otherwise.
Quoted 5 lines
drivers/devfreq/mtk-cci-devfreq.c +0
-0
drivers/devfreq/mtk-cci-devfreq.c static int mtk_ccifreq_probe(struct platform_device *pdev) · line 371
Quoted 10 lines
drivers/devfreq/mtk-cci-devfreq.c +2
-2@@ -364,8 +364,8 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) passive_data);if (IS_ERR (drv->devfreq)) { ret = -EPROBE_DEFER ; -dev_err (dev,"failed to add devfreq device: %ld\n" , -PTR_ERR (drv->devfreq)); +dev_err (dev,"failed to add devfreq device: %pe\n" , + drv->devfreq); goto out_remove_opp_table; }
[Severity: High]
This is a pre-existing issue, but mixing devm-managed devfreq devices with manual resource cleanup appears to create a use-after-free window where the devfreq governor remains active.
In mtk_ccifreq_probe(), if dev_pm_opp_register_notifier() fails later in the function, it jumps to the cleanup code:
mtk_ccifreq_probe() {
...
drv->devfreq = devm_devfreq_add_device(...);
...
ret = dev_pm_opp_register_notifier(dev, &drv->opp_nb);
if (ret) {
...
goto out_remove_opp_table;
}
return 0;out_remove_opp_table:
dev_pm_opp_of_remove_table(dev);
out_disable_cci_clk:
clk_disable_unprepare(drv->cci_clk);
...
}This manual cleanup is performed before devres cleans up the devm-managed devfreq device. Since the passive governor registers a CPU frequency notifier, could a background CPU frequency transition during this window trigger the target callback on freed OPP tables and disabled hardware, potentially leading to a kernel panic?
A similar issue appears to exist in mtk_ccifreq_remove(), where manual cleanup occurs before devres stops the devfreq passive governor.
Additionally, in imx_bus_probe() in drivers/devfreq/imx-bus.c, the error path manual cleanup creates a use-after-free window for the still-active devfreq device. Since it uses the userspace governor, does this make it susceptible to sysfs writes during module removal or probe failures?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Krzysztof Kozlowski
maintainerRe: [PATCH 2/5] thermal: Use %pe to print error pointers symbolically
In reply to Sumeet Pawnikardrivers/thermal/thermal_mmio.c static int thermal_mmio_probe(struct platform_device *pdev) · line 75
Quoted 9 lines · Sumeet Pawnikar
+++
b/drivers/thermal/thermal_mmio.cdrivers/thermal/thermal_mmio.c +1
-2@@ -71,8 +71,7 @@ static int thermal_mmio_probe(struct platform_device *pdev) &thermal_mmio_ops);if (IS_ERR (thermal_zone)) {dev_err (&pdev->dev, -"failed to register sensor (%ld)\n" , -PTR_ERR (thermal_zone)); +"failed to register sensor (%pe)\n" , thermal_zone);return PTR_ERR (thermal_zone);
Same comments. Syntax is just return dev_err_probe. When making such changes, you should not do them blindly, but replace the code into really the correct one.
Best regards,
Krzysztof
Krzysztof Kozlowski
maintainerRe: [PATCH 5/5] power: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarQuoted 6 lines · Sumeet Pawnikar
(quoted diff) +0
-0}drivers/power/supply/cw2015_battery.c +0
-0
drivers/power/supply/cw2015_battery.c static int cw_bat_probe(struct i2c_client *client) · line 663
Quoted 8 lines
drivers/power/supply/cw2015_battery.c +2
-2@@ -658,8 +658,8 @@ static int cw_bat_probe(struct i2c_client *client) cw_bat->regmap =devm_regmap_init_i2c (client, &cw2015_regmap_config);if (IS_ERR (cw_bat->regmap)) { -dev_err (cw_bat->dev,"Failed to allocate regmap: %ld\n" , -PTR_ERR (cw_bat->regmap)); +dev_err (cw_bat->dev,"Failed to allocate regmap: %pe\n" , + cw_bat->regmap);return PTR_ERR (cw_bat->regmap);
return dev_err_probe
Instead you should use dev_err_probe and drop the last argument.
Best regards,
Krzysztof
Krzysztof Kozlowski
maintainerRe: [PATCH 4/5] devfreq: Use %pe to print error pointers symbolically
In reply to Sumeet Pawnikardrivers/devfreq/mtk-cci-devfreq.c static int mtk_ccifreq_probe(struct platform_device *pdev) · line 368
Quoted 5 lines · Sumeet Pawnikar
drivers/devfreq/mtk-cci-devfreq.c +2
-2ret = -EPROBE_DEFER ; -dev_err (dev,"failed to add devfreq device: %ld\n" , -PTR_ERR (drv->devfreq)); +dev_err (dev,"failed to add devfreq device: %pe\n" , + drv->devfreq);
Instead you should use dev_err_probe and drop the last argument.
Best regards,
Krzysztof
Re: [PATCH 3/5] cpufreq: Use %pe to print error pointers symbolically
In reply to Sumeet PawnikarQuoted 6 lines · Sumeet Pawnikar
Replace
PTR_ERR()and %ld with %pe and pass the original pointer directly topr_err()andpr_warn(). The %pe format specifier prints a symbolic error name (e.g.-ENOMEM) whenCONFIG_SYMBOLIC_ERRNAMEis enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change.
Quoted 7 lines
Signed-off-by Sumeet Pawnikar <[email protected]>--- drivers/cpufreq/bmips-cpufreq.c | 4 ++-- drivers/cpufreq/cppc_cpufreq.c | 4 ++-- drivers/cpufreq/qoriq-cpufreq.c | 4 ++-- drivers/cpufreq/s3c64xx-cpufreq.c | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-)
Applied. Thanks.
Signature · 1 line
viresh
Re: [PATCH 4/5] devfreq: Use %pe to print error pointers symbolically
In reply to Krzysztof KozlowskiQuoted 10 lines · Krzysztof Kozlowski
drivers/devfreq/mtk-cci-devfreq.c static int mtk_ccifreq_probe(struct platform_device *pdev) · line 368
Quoted 5 lines · Sumeet Pawnikar
ret = -EPROBE_DEFER;drivers/devfreq/mtk-cci-devfreq.c +2
-2-dev_err (dev,"failed to add devfreq device: %ld\n" , -PTR_ERR (drv->devfreq)); +dev_err (dev,"failed to add devfreq device: %pe\n" , + drv->devfreq);Instead you should use
dev_err_probeand drop the last argument.
Sure. I'll do this suggested usage of dev_err_probe in different patch series for *_probe() functions update.
Planning to post V2 for this original series to use %pe to print the error pointers symbolically, reverting the change for dev_err under *_porbe() function.
Thanks,
Sumeet.
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 5/5] power: Use %pe to print error pointers symbolically
In reply to Krzysztof KozlowskiQuoted 19 lines · Krzysztof Kozlowski
Quoted 6 lines · Sumeet Pawnikar
}drivers/power/supply/cw2015_battery.c +0
-0drivers/power/supply/cw2015_battery.c static int cw_bat_probe(struct i2c_client *client) · line 663
Quoted 8 lines
drivers/power/supply/cw2015_battery.c +2
-2@@ -658,8 +658,8 @@ static int cw_bat_probe(struct i2c_client *client) cw_bat->regmap =devm_regmap_init_i2c (client, &cw2015_regmap_config);if (IS_ERR (cw_bat->regmap)) { -dev_err (cw_bat->dev,"Failed to allocate regmap: %ld\n" , -PTR_ERR (cw_bat->regmap)); +dev_err (cw_bat->dev,"Failed to allocate regmap: %pe\n" , + cw_bat->regmap);return PTR_ERR (cw_bat->regmap);return
dev_err_probe
Quoted 2 lines
Instead you should use
dev_err_probeand drop the last argument.
Sure. I'll do this suggested usage of dev_err_probe in different patch series for *_probe() functions update.
As of now reverting the change for dev_err under *_porbe() function and planning to post V2 for this original series to use %pe for review.
Thanks,
Sumeet.
Quoted 2 lines
Best regards,
Krzysztof