Skip to contentSkip to conversation

drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code

PATCH In review zhengbin 2 participants 6 messages Nov 18, 2019

Subsystems (3)
lore
Share & tools
lore

zhengbin

author
#0 lore raw

cover drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code

zhengbin (4):
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi_audio_register
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi4_core_init
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi5_core_init
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi_phy_init

 drivers/gpu/drm/omapdrm/dss/hdmi4.c      | 5 +----
 drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 5 +----
 drivers/gpu/drm/omapdrm/dss/hdmi5_core.c | 5 +----
 drivers/gpu/drm/omapdrm/dss/hdmi_phy.c   | 5 +----
 4 files changed, 4 insertions(+), 16 deletions(-)

--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#1 lore raw

PATCH 1/4 drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi_audio_register

Fixes coccicheck warning:

drivers/gpu/drm/omapdrm/dss/hdmi4.c:590:1-3: WARNING: PTR_ERR_OR_ZERO can be used

---
 drivers/gpu/drm/omapdrm/dss/hdmi4.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi4.c +1 -4
index 0f557fa..eb71bae 100644
@@ -587,10 +587,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);
 }
 
 /* -----------------------------------------------------------------------------

--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw

PATCH 2/4 drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi4_core_init

In reply to zhengbin

Fixes coccicheck warning:

drivers/gpu/drm/omapdrm/dss/hdmi4_core.c:927:1-3: WARNING: PTR_ERR_OR_ZERO can be used

---
 drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c +1 -4
index ea5d5c2..ba512f8 100644
@@ -924,8 +924,5 @@ 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);
 }

--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#3 lore raw

PATCH 3/4 drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi5_core_init

In reply to zhengbin

Fixes coccicheck warning:

drivers/gpu/drm/omapdrm/dss/hdmi5_core.c:911:1-3: WARNING: PTR_ERR_OR_ZERO can be used

---
 drivers/gpu/drm/omapdrm/dss/hdmi5_core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi5_core.c +1 -4
index ff4d35c..b577969 100644
@@ -908,8 +908,5 @@ 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);
 }

--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#4 lore raw

PATCH 4/4 drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi_phy_init

In reply to zhengbin

Fixes coccicheck warning:

drivers/gpu/drm/omapdrm/dss/hdmi_phy.c:194:1-3: WARNING: PTR_ERR_OR_ZERO can be used

---
 drivers/gpu/drm/omapdrm/dss/hdmi_phy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi_phy.c +1 -4
index 00bbf24..408b2e0 100644
@@ -191,8 +191,5 @@ 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

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to zhengbin

Hi zhengbin,

Quoted 9 lines · zhengbin

zhengbin (4):
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi_audio_register
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi4_core_init
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in
hdmi5_core_init
drm/omap: dss: Use PTR_ERR_OR_ZERO() to simplify code in hdmi_phy_init

Quoted 5 lines
  drivers/gpu/drm/omapdrm/dss/hdmi4.c      | 5 +----
  drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 5 +----
  drivers/gpu/drm/omapdrm/dss/hdmi5_core.c | 5 +----
  drivers/gpu/drm/omapdrm/dss/hdmi_phy.c   | 5 +----
  4 files changed, 4 insertions(+), 16 deletions(-)

Thanks, but I don't like PTR_ERR_OR_ZERO, I think it makes the code more difficult to read and manage.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel