linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used
@ 2019-05-25  7:30 Hariprasad Kelam
  2019-05-25 14:56 ` Matteo Croce
  0 siblings, 1 reply; 3+ messages in thread
From: Hariprasad Kelam @ 2019-05-25  7:30 UTC (permalink / raw)
  To: Tomi Valkeinen, David Airlie, Daniel Vetter, Laurent Pinchart,
	Sebastian Reichel, Hariprasad Kelam, Matteo Croce, dri-devel,
	linux-kernel

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used
  2019-05-25  7:30 [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
@ 2019-05-25 14:56 ` Matteo Croce
  2019-05-27  9:06   ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Matteo Croce @ 2019-05-25 14:56 UTC (permalink / raw)
  To: Hariprasad Kelam, Tomi Valkeinen
  Cc: David Airlie, Daniel Vetter, Laurent Pinchart, Sebastian Reichel,
	dri-devel, LKML

On Sat, May 25, 2019 at 9:30 AM Hariprasad Kelam
<hariprasad.kelam@gmail.com> wrote:
>
> fix below warnings reported by coccicheck
>

Hi,

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

https://lore.kernel.org/lkml/3dec4093-824e-b13d-d712-2dedd445a7b7@ti.com/

Tomi, what's your thought?

-- 
Matteo Croce
per aspera ad upstream

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used
  2019-05-25 14:56 ` Matteo Croce
@ 2019-05-27  9:06   ` Tomi Valkeinen
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2019-05-27  9:06 UTC (permalink / raw)
  To: Matteo Croce, Hariprasad Kelam
  Cc: David Airlie, Daniel Vetter, Laurent Pinchart, Sebastian Reichel,
	dri-devel, LKML

Hi,

On 25/05/2019 17:56, Matteo Croce wrote:
> On Sat, May 25, 2019 at 9:30 AM Hariprasad Kelam
> <hariprasad.kelam@gmail.com> wrote:
>>
>> fix below warnings reported by coccicheck
>>
> 
> Hi,
> 
> a similar patch was nacked because it makes backports more difficult:
> 
> https://lore.kernel.org/lkml/3dec4093-824e-b13d-d712-2dedd445a7b7@ti.com/
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-27  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25  7:30 [PATCH] drm/omapdrm: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
2019-05-25 14:56 ` Matteo Croce
2019-05-27  9:06   ` Tomi Valkeinen

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).