From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Subject: [PATCH] fix ptr_ret.cocci warnings Date: Mon, 15 May 2017 18:52:11 +0800 (SGT) Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1565353947-1494845536=:4315" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, "Jason A. Donenfeld" , kbuild-all@01.org To: =?ISO-8859-15?Q?Stephan_M=FCller?= Return-path: Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:49500 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755099AbdEOKwS (ORCPT ); Mon, 15 May 2017 06:52:18 -0400 Sender: linux-crypto-owner@vger.kernel.org List-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1565353947-1494845536=:4315 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci CC: Stephan Müller Signed-off-by: Julia Lawall Signed-off-by: Fengguang Wu --- 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 ***************************/ --8323329-1565353947-1494845536=:4315--