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

From: Maxime Ripard
Date: Sun May 26 2019 - 15:23:09 EST


Hi!

On Sat, May 25, 2019 at 12:55:09PM +0530, Hariprasad Kelam wrote:
> fix below warnings reported by coccicheck
>
> ./drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c:174:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c:236:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c:285:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c:142:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/gpu/drm/sun4i/sun4i_dotclock.c:198:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@xxxxxxxxx>
> ---
> drivers/gpu/drm/sun4i/sun4i_dotclock.c | 4 +---
> drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c | 4 +---
> drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 4 +---
> drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 4 +---
> drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c | 4 +---
> 5 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
> index 2a15f2f..e0fd19d 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
> @@ -195,10 +195,8 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon)
> dclk->hw.init = &init;
>
> tcon->dclk = clk_register(dev, &dclk->hw);
> - if (IS_ERR(tcon->dclk))
> - return PTR_ERR(tcon->dclk);
>
> - return 0;
> + return PTR_ERR_OR_ZERO(tcon->dclk);

Unfortunately, that was on purpose. It's much easier to extend if we
ever need to change anything there.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: PGP signature