[PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used

From: Hariprasad Kelam
Date: Sat May 25 2019 - 03:33:49 EST


fix below warnings reported by coccicheck

./drivers/gpu/drm/omapdrm/dss/hdmi_phy.c:197:1-3: WARNING:
PTR_ERR_OR_ZERO can be used
./drivers/gpu/drm/omapdrm/dss/hdmi4_core.c:937:1-3: WARNING:
PTR_ERR_OR_ZERO can be used
./drivers/gpu/drm/omapdrm/dss/hdmi5_core.c:913:1-3: WARNING:
PTR_ERR_OR_ZERO can be used
./drivers/gpu/drm/omapdrm/dss/hdmi4.c:601:1-3: WARNING: PTR_ERR_OR_ZERO
can be used

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@xxxxxxxxx>
---
drivers/gpu/drm/omapdrm/dss/hdmi4.c | 5 +----
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 6 ++----
drivers/gpu/drm/omapdrm/dss/hdmi5_core.c | 4 +---
drivers/gpu/drm/omapdrm/dss/hdmi_phy.c | 4 +---
4 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 6339e27..cce53f3 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -598,10 +598,7 @@ static int hdmi_audio_register(struct omap_hdmi *hdmi)
&hdmi->pdev->dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO,
&pdata, sizeof(pdata));

- if (IS_ERR(hdmi->audio_pdev))
- return PTR_ERR(hdmi->audio_pdev);
-
- return 0;
+ return PTR_ERR_OR_ZERO(hdmi->audio_pdev);
}

/* -----------------------------------------------------------------------------
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index e384b95..1bcdb54 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -934,8 +934,6 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
core->base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(core->base))
- return PTR_ERR(core->base);
-
- return 0;
+
+ return PTR_ERR_OR_ZERO(core->base);
}
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
index 02efabc..022c2ce 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
@@ -910,8 +910,6 @@ int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core)

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
core->base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(core->base))
- return PTR_ERR(core->base);

- return 0;
+ return PTR_ERR_OR_ZERO(core->base);
}
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index 9915923..a7d7040 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -194,8 +194,6 @@ int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
phy->base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(phy->base))
- return PTR_ERR(phy->base);

- return 0;
+ return PTR_ERR_OR_ZERO(phy->base);
}
--
2.7.4