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 <[email protected]>
---
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);
}
EXPORT_SYMBOL(sun4i_dclk_create);
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
index e826da3..1e74040 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
@@ -139,8 +139,6 @@ int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *parent)
ddc->m_offset = hdmi->variant->ddc_clk_m_offset;
hdmi->ddc_clk = devm_clk_register(hdmi->dev, &ddc->hw);
- if (IS_ERR(hdmi->ddc_clk))
- return PTR_ERR(hdmi->ddc_clk);
- return 0;
+ return PTR_ERR_OR_ZERO(hdmi->ddc_clk);
}
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
index 58e9d37..b72f9c7 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
@@ -282,10 +282,8 @@ static int sun4i_hdmi_init_regmap_fields(struct sun4i_hdmi *hdmi)
hdmi->field_ddc_sck_en =
devm_regmap_field_alloc(hdmi->dev, hdmi->regmap,
hdmi->variant->field_ddc_sck_en);
- if (IS_ERR(hdmi->field_ddc_sck_en))
- return PTR_ERR(hdmi->field_ddc_sck_en);
- return 0;
+ return PTR_ERR_OR_ZERO(hdmi->field_ddc_sck_en);
}
int sun4i_hdmi_i2c_create(struct device *dev, struct sun4i_hdmi *hdmi)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
index 2598741..389c1c5 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
@@ -233,8 +233,6 @@ int sun4i_tmds_create(struct sun4i_hdmi *hdmi)
tmds->div_offset = hdmi->variant->tmds_clk_div_offset;
hdmi->tmds_clk = devm_clk_register(hdmi->dev, &tmds->hw);
- if (IS_ERR(hdmi->tmds_clk))
- return PTR_ERR(hdmi->tmds_clk);
- return 0;
+ return PTR_ERR_OR_ZERO(hdmi->tmds_clk);
}
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
index a4d31fe..d52f581 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
@@ -171,8 +171,6 @@ int sun8i_phy_clk_create(struct sun8i_hdmi_phy *phy, struct device *dev,
priv->hw.init = &init;
phy->clk_phy = devm_clk_register(dev, &priv->hw);
- if (IS_ERR(phy->clk_phy))
- return PTR_ERR(phy->clk_phy);
- return 0;
+ return PTR_ERR_OR_ZERO(phy->clk_phy);
}
--
2.7.4
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 <[email protected]>
> ---
> 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