2019-05-25 07:31:52

by Hariprasad Kelam

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

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 <[email protected]>
---
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


2019-05-25 14:59:18

by Matteo Croce

[permalink] [raw]
Subject: Re: [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used

On Sat, May 25, 2019 at 9:30 AM Hariprasad Kelam
<[email protected]> wrote:
>
> fix below warnings reported by coccicheck
>

Hi,

a similar patch was nacked because it makes backports more difficult:

https://lore.kernel.org/lkml/[email protected]/

Tomi, what's your thought?

--
Matteo Croce
per aspera ad upstream

2019-05-27 09:09:37

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used

Hi,

On 25/05/2019 17:56, Matteo Croce wrote:
> On Sat, May 25, 2019 at 9:30 AM Hariprasad Kelam
> <[email protected]> wrote:
>>
>> fix below warnings reported by coccicheck
>>
>
> Hi,
>
> a similar patch was nacked because it makes backports more difficult:
>
> https://lore.kernel.org/lkml/[email protected]/
>
> Tomi, what's your thought?
>

I don't particularly like the PTR_ERR_OR_ZERO, and changing old code to
use it seem pointless.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki