linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: sun4i: Use PTR_ERR_OR_ZERO to simplify the code
@ 2019-10-31 14:09 zhong jiang
  2019-11-01  9:13 ` Maxime Ripard
  0 siblings, 1 reply; 5+ messages in thread
From: zhong jiang @ 2019-10-31 14:09 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: perex, tiwai, mripard, zhongjiang, linux-kernel

It is better to use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 sound/soc/sunxi/sun4i-i2s.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
index d0a8d58..72012a6 100644
--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -1174,10 +1174,8 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev,
 	i2s->field_fmt_sr =
 			devm_regmap_field_alloc(dev, i2s->regmap,
 						i2s->variant->field_fmt_sr);
-	if (IS_ERR(i2s->field_fmt_sr))
-		return PTR_ERR(i2s->field_fmt_sr);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(i2s->field_fmt_sr);
 }
 
 static int sun4i_i2s_probe(struct platform_device *pdev)
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-02 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 14:09 [PATCH] ASoC: sun4i: Use PTR_ERR_OR_ZERO to simplify the code zhong jiang
2019-11-01  9:13 ` Maxime Ripard
2019-11-01 11:55   ` zhong jiang
2019-11-01 14:53     ` Maxime Ripard
2019-11-02 14:45       ` zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).