Re: [PATCH] drm: omapdrm: hdmi: Use PTR_ERR_OR_ZERO
From: Laurent Pinchart
Date: Thu Aug 31 2017 - 11:00:33 EST
Hi Himanshu,
Thank you for the patch.
On Tuesday, 29 August 2017 17:00:12 EEST Himanshu Jha wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: Himanshu Jha <himanshujha199640@xxxxxxxxx>
Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index f169348..3bf81e1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -676,10 +676,7 @@ static int hdmi_audio_register(struct device *dev)
> 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);
> }
>
> /* HDMI HW IP initialisation */
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
> b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c index 365cf07..aafd723 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
> @@ -922,8 +922,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);
> }
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
> b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c index ab179ec..45c7b0f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
> @@ -911,8 +911,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);
> }
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
> b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c index a156292..12a85cb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
> @@ -194,8 +194,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);
> }
--
Regards,
Laurent Pinchart