From patchwork Mon May 15 10:52:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 9726667 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1DBB60231 for ; Mon, 15 May 2017 10:52:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C858526E16 for ; Mon, 15 May 2017 10:52:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B873827F90; Mon, 15 May 2017 10:52:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACCA226E16 for ; Mon, 15 May 2017 10:52:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755194AbdEOKwS (ORCPT ); Mon, 15 May 2017 06:52:18 -0400 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 X-IronPort-AV: E=Sophos;i="5.38,344,1491256800"; d="scan'208";a="273138937" Received: from unknown (HELO hadrien.local) ([202.161.57.226]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2017 12:52:14 +0200 Date: Mon, 15 May 2017 18:52:11 +0800 (SGT) From: Julia Lawall X-X-Sender: jll@hadrien To: =?ISO-8859-15?Q?Stephan_M=FCller?= cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, "Jason A. Donenfeld" , kbuild-all@01.org Subject: [PATCH] fix ptr_ret.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 ***************************/