Commit 045e81d8 authored by Yang Xiuwei's avatar Yang Xiuwei Committed by Kevin Hilman
Browse files

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: default avatarYang Xiuwei <yangxiuwei@kylinos.cn>
Reviewed-by: default avatarAndreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/20250817083449.2249268-1-yangxiuwei2025@163.com


Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
parent 8a6506e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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))) {
+6 −6
Original line number Diff line number Diff line
@@ -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;
	}
+2 −2
Original line number Diff line number Diff line
@@ -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;
	}