Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641540 > unrolled thread

[PATCH] fix ptr_ret.cocci warnings

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2017-05-15 13:00 +0200
Last post2017-05-15 13:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] fix ptr_ret.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2017-05-15 13:00 +0200

#1641540 — [PATCH] fix ptr_ret.cocci warnings

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-05-15 13:00 +0200
Subject[PATCH] fix ptr_ret.cocci warnings
Message-ID<tHlTk-72L-7@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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

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

CC: Stephan Müller <smueller@chronox.de>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

Not very important, but the code can be a little simpler.

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

--- a/drivers/char/lrng_base.c
+++ b/drivers/char/lrng_base.c
@@ -1523,10 +1523,7 @@ static int lrng_alloc(void)
 	lrng_init_rng(key, sizeof(key));
 	lrng_pool.lrng_hash = lrng_hash_alloc(LRNG_HASH_NAME, key, sizeof(key));
 	memzero_explicit(key, sizeof(key));
-	if (IS_ERR(lrng_pool.lrng_hash))
-		return PTR_ERR(lrng_pool.lrng_hash);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(lrng_pool.lrng_hash);
 }

 /************************** LRNG kernel interfaces ***************************/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web