diff mbox series

thermal: armada: fix ptr_ret.cocci warnings

Message ID 20180727234735.GA136792@lkp-hsx02 (mailing list archive)
State Not Applicable, archived
Headers show
Series thermal: armada: fix ptr_ret.cocci warnings | expand

Commit Message

Fengguang Wu July 27, 2018, 11:47 p.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

drivers/thermal/armada_thermal.c:435:1-3: WARNING: PTR_ERR_OR_ZERO can be used
drivers/thermal/armada_thermal.c:445:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 46d9e25062c2 ("thermal: armada: convert driver to syscon register accesses")
CC: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 armada_thermal.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff mbox series

Patch

--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -432,20 +432,14 @@  static int armada_thermal_probe_legacy(s
 
 	priv->syscon = devm_regmap_init_mmio(&pdev->dev, base,
 					     &armada_thermal_regmap_config);
-	if (IS_ERR(priv->syscon))
-		return PTR_ERR(priv->syscon);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(priv->syscon);
 }
 
 static int armada_thermal_probe_syscon(struct platform_device *pdev,
 				       struct armada_thermal_priv *priv)
 {
 	priv->syscon = syscon_node_to_regmap(pdev->dev.parent->of_node);
-	if (IS_ERR(priv->syscon))
-		return PTR_ERR(priv->syscon);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(priv->syscon);
 }
 
 static void armada_set_sane_name(struct platform_device *pdev,