Skip to content

Commit 045e81d

Browse files
Yang Xiuweikhilman
authored andcommitted
ARM: OMAP2+: use IS_ERR_OR_NULL() helper
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> Link: https://lore.kernel.org/r/20250817083449.2249268-1-yangxiuwei2025@163.com Signed-off-by: Kevin Hilman <khilman@baylibre.com>
1 parent 8a6506e commit 045e81d

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

arch/arm/mach-omap2/powerdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst)
11111111
int curr_pwrst;
11121112
int ret = 0;
11131113

1114-
if (!pwrdm || IS_ERR(pwrdm))
1114+
if (IS_ERR_OR_NULL(pwrdm))
11151115
return -EINVAL;
11161116

11171117
while (!(pwrdm->pwrsts & (1 << pwrst))) {

arch/arm/mach-omap2/voltage.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static LIST_HEAD(voltdm_list);
5151
*/
5252
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
5353
{
54-
if (!voltdm || IS_ERR(voltdm)) {
54+
if (IS_ERR_OR_NULL(voltdm)) {
5555
pr_warn("%s: VDD specified does not exist!\n", __func__);
5656
return 0;
5757
}
@@ -73,7 +73,7 @@ static int voltdm_scale(struct voltagedomain *voltdm,
7373
int ret, i;
7474
unsigned long volt = 0;
7575

76-
if (!voltdm || IS_ERR(voltdm)) {
76+
if (IS_ERR_OR_NULL(voltdm)) {
7777
pr_warn("%s: VDD specified does not exist!\n", __func__);
7878
return -EINVAL;
7979
}
@@ -124,7 +124,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
124124
{
125125
unsigned long target_volt;
126126

127-
if (!voltdm || IS_ERR(voltdm)) {
127+
if (IS_ERR_OR_NULL(voltdm)) {
128128
pr_warn("%s: VDD specified does not exist!\n", __func__);
129129
return;
130130
}
@@ -154,7 +154,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
154154
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
155155
struct omap_volt_data **volt_data)
156156
{
157-
if (!voltdm || IS_ERR(voltdm)) {
157+
if (IS_ERR_OR_NULL(voltdm)) {
158158
pr_warn("%s: VDD specified does not exist!\n", __func__);
159159
return;
160160
}
@@ -182,7 +182,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
182182
{
183183
int i;
184184

185-
if (!voltdm || IS_ERR(voltdm)) {
185+
if (IS_ERR_OR_NULL(voltdm)) {
186186
pr_warn("%s: VDD specified does not exist!\n", __func__);
187187
return ERR_PTR(-EINVAL);
188188
}
@@ -216,7 +216,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
216216
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
217217
struct omap_voltdm_pmic *pmic)
218218
{
219-
if (!voltdm || IS_ERR(voltdm)) {
219+
if (IS_ERR_OR_NULL(voltdm)) {
220220
pr_warn("%s: VDD specified does not exist!\n", __func__);
221221
return -EINVAL;
222222
}

arch/arm/mach-omap2/vp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
199199
struct omap_vp_instance *vp;
200200
u32 vpconfig, volt;
201201

202-
if (!voltdm || IS_ERR(voltdm)) {
202+
if (IS_ERR_OR_NULL(voltdm)) {
203203
pr_warn("%s: VDD specified does not exist!\n", __func__);
204204
return;
205205
}
@@ -244,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
244244
u32 vpconfig;
245245
int timeout;
246246

247-
if (!voltdm || IS_ERR(voltdm)) {
247+
if (IS_ERR_OR_NULL(voltdm)) {
248248
pr_warn("%s: VDD specified does not exist!\n", __func__);
249249
return;
250250
}

0 commit comments

Comments
 (0)