[PATCH] drm/sun4i: fix warning PTR_ERR_OR_ZERO can be used
Maxime Ripard
maxime.ripard at bootlin.com
Sun May 26 19:19:40 UTC 2019
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 at gmail.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190526/db5d37ff/attachment.sig>
More information about the dri-devel
mailing list