[PATCH] ASoC: sun4i-i2s: fix ptr_ret.cocci warnings

kbuild test robot lkp at intel.com
Sun Jul 30 09:43:30 PDT 2017


sound/soc/sunxi/sun4i-i2s.c:740: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: 298207690de9 ("ASoC: sun4i-i2s: Add regmap fields for channels")
CC: Marcus Cooper <codekipper at gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
---

 sun4i-i2s.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -737,10 +737,7 @@ static int sun4i_i2s_init_regmap_fields(
 	i2s->field_rxchansel =
 		devm_regmap_field_alloc(dev, i2s->regmap,
 					i2s->variant->field_rxchansel);
-	if (IS_ERR(i2s->field_rxchansel))
-		return PTR_ERR(i2s->field_rxchansel);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(i2s->field_rxchansel);
 }
 
 static int sun4i_i2s_probe(struct platform_device *pdev)



More information about the linux-arm-kernel mailing list