diff mbox series

drm/sun4i: use PTR_ERR_OR_ZERO macro.

Message ID 20200106140052.30747-1-wambui.karugax@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/sun4i: use PTR_ERR_OR_ZERO macro. | expand

Commit Message

Wambui Karuga Jan. 6, 2020, 2 p.m. UTC
Replace the use of IS_ERR and PTR_ZERO macros by returning the
PTR_ERR_OR_ZERO macro.
Changes suggested by coccinelle. 

Signed-off-by: Wambui Karuga <wambui.karugax@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/sun8i_hdmi_phy_clk.c | 4 +---
 4 files changed, 4 insertions(+), 12 deletions(-)

Comments

Maxime Ripard Jan. 7, 2020, 11:57 a.m. UTC | #1
Hi,

On Mon, Jan 06, 2020 at 05:00:52PM +0300, Wambui Karuga wrote:
> Replace the use of IS_ERR and PTR_ZERO macros by returning the
> PTR_ERR_OR_ZERO macro.
> Changes suggested by coccinelle.
>
> Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>

Unfortunately, that patch came up a number of time and shouldn't have
been a coccinelle script in the first place.

I've sent a patch to remove that script:
https://lore.kernel.org/lkml/20200107073629.325249-1-maxime@cerno.tech/

Maxime
Wambui Karuga Jan. 7, 2020, 12:45 p.m. UTC | #2
On Tue, 7 Jan 2020, Maxime Ripard wrote:

> Hi,
>
> On Mon, Jan 06, 2020 at 05:00:52PM +0300, Wambui Karuga wrote:
>> Replace the use of IS_ERR and PTR_ZERO macros by returning the
>> PTR_ERR_OR_ZERO macro.
>> Changes suggested by coccinelle.
>>
>> Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
>
> Unfortunately, that patch came up a number of time and shouldn't have
> been a coccinelle script in the first place.
>
> I've sent a patch to remove that script:
> https://lore.kernel.org/lkml/20200107073629.325249-1-maxime@cerno.tech/
>
Okay, thanks for the review.
> Maxime
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 417ade3d2565..84c04d8192b3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -191,10 +191,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 2ff780114106..7a59505d6907 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
@@ -135,8 +135,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 b66fa27fe6ea..12a7b7b1c99c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
@@ -278,10 +278,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/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
index a4d31fe3abff..fd09eff21b25 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)
 }