* [PATCH] ARM: OMAP2+: use IS_ERR_OR_NULL() helper
@ 2025-08-17 8:34 Yang Xiuwei
2025-08-18 17:12 ` Andreas Kemnade
0 siblings, 1 reply; 2+ messages in thread
From: Yang Xiuwei @ 2025-08-17 8:34 UTC (permalink / raw)
To: tony, khilman; +Cc: linux-omap, linux-arm-kernel, Yang Xiuwei
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Simplify error handling in OMAP powerdomain, voltage, and VP code by
replacing open-coded '!ptr || IS_ERR(ptr)' checks with the combined
IS_ERR_OR_NULL() helper.
This improves readability and consistency across
omap_set_pwrdm_state(), voltdm_get_voltage(), voltdm_scale(),
voltdm_reset(), and related functions.
No functional change intended.
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index a4785302b7ae..0225b9889404 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1111,7 +1111,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst)
int curr_pwrst;
int ret = 0;
- if (!pwrdm || IS_ERR(pwrdm))
+ if (IS_ERR_OR_NULL(pwrdm))
return -EINVAL;
while (!(pwrdm->pwrsts & (1 << pwrst))) {
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 49e8bc69abdd..000c2bca5ef0 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -51,7 +51,7 @@ static LIST_HEAD(voltdm_list);
*/
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
{
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return 0;
}
@@ -73,7 +73,7 @@ static int voltdm_scale(struct voltagedomain *voltdm,
int ret, i;
unsigned long volt = 0;
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return -EINVAL;
}
@@ -124,7 +124,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
{
unsigned long target_volt;
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
@@ -154,7 +154,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
struct omap_volt_data **volt_data)
{
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
@@ -182,7 +182,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
{
int i;
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return ERR_PTR(-EINVAL);
}
@@ -216,7 +216,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
struct omap_voltdm_pmic *pmic)
{
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return -EINVAL;
}
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index a709655b978c..03c481c4742c 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -199,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
struct omap_vp_instance *vp;
u32 vpconfig, volt;
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
@@ -244,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
u32 vpconfig;
int timeout;
- if (!voltdm || IS_ERR(voltdm)) {
+ if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: OMAP2+: use IS_ERR_OR_NULL() helper
2025-08-17 8:34 [PATCH] ARM: OMAP2+: use IS_ERR_OR_NULL() helper Yang Xiuwei
@ 2025-08-18 17:12 ` Andreas Kemnade
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Kemnade @ 2025-08-18 17:12 UTC (permalink / raw)
To: Yang Xiuwei; +Cc: tony, khilman, linux-omap, linux-arm-kernel, Yang Xiuwei
Am Sun, 17 Aug 2025 16:34:49 +0800
schrieb Yang Xiuwei <yangxiuwei2025@163.com>:
> From: Yang Xiuwei <yangxiuwei@kylinos.cn>
>
> Simplify error handling in OMAP powerdomain, voltage, and VP code by
> replacing open-coded '!ptr || IS_ERR(ptr)' checks with the combined
> IS_ERR_OR_NULL() helper.
>
> This improves readability and consistency across
> omap_set_pwrdm_state(), voltdm_get_voltage(), voltdm_scale(),
> voltdm_reset(), and related functions.
>
> No functional change intended.
>
> Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-18 17:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-17 8:34 [PATCH] ARM: OMAP2+: use IS_ERR_OR_NULL() helper Yang Xiuwei
2025-08-18 17:12 ` Andreas Kemnade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).