From patchwork Fri Aug 26 15:19:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 9301603 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 46818601C0 for ; Fri, 26 Aug 2016 15:21:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 377AB29638 for ; Fri, 26 Aug 2016 15:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BC342963A; Fri, 26 Aug 2016 15:21:27 +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 6D2B429638 for ; Fri, 26 Aug 2016 15:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751139AbcHZPVZ (ORCPT ); Fri, 26 Aug 2016 11:21:25 -0400 Received: from helcar.hengli.com.au ([209.40.204.226]:59172 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbcHZPVX (ORCPT ); Fri, 26 Aug 2016 11:21:23 -0400 Received: from gondolin.me.apana.org.au ([192.168.0.6]) by norbury.hengli.com.au with esmtp (Exim 4.80 #3 (Debian)) id 1bdIuy-0003w7-Om; Sat, 27 Aug 2016 01:19:40 +1000 Received: from herbert by gondolin.me.apana.org.au with local (Exim 4.80) (envelope-from ) id 1bdIux-0005uG-Am; Fri, 26 Aug 2016 23:19:39 +0800 Date: Fri, 26 Aug 2016 23:19:39 +0800 From: Herbert Xu To: Stephen Rothwell Cc: Martin Schwidefsky , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Linux Crypto Mailing List Subject: crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset Message-ID: <20160826151938.GA22619@gondor.apana.org.au> References: <20160825113824.61ca7364@canb.auug.org.au> <20160825082010.5523ae6f@mschwide> <20160825074701.GA11175@gondor.apana.org.au> <20160825211411.08858397@canb.auug.org.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160825211411.08858397@canb.auug.org.au> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Thu, Aug 25, 2016 at 09:14:11PM +1000, Stephen Rothwell wrote: > > That looks fine to me. An alternative might be to have: > > #ifndef XOR_SELECT_TEMPLATE > #define XOR_SELECT_TEMPLATE(x) (x) > #endif > > near the top of the file. That gets the #ifdef out of the code flow > and serves as some hint that such a thing can be defined by arch header > files. Good idea. Thanks Stephen. ---8<--- This patch fixes an unused label warning triggered when the macro XOR_SELECT_TEMPLATE is not set. Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...") Reported-by: Stephen Rothwell Suggested-by: Stephen Rothwell Signed-off-by: Herbert Xu diff --git a/crypto/xor.c b/crypto/xor.c index b8975d9..263af9f 100644 --- a/crypto/xor.c +++ b/crypto/xor.c @@ -24,6 +24,10 @@ #include #include +#ifndef XOR_SELECT_TEMPLATE +#define XOR_SELECT_TEMPLATE(x) (x) +#endif + /* The xor routines to use. */ static struct xor_block_template *active_template; @@ -109,17 +113,14 @@ calibrate_xor_blocks(void) void *b1, *b2; struct xor_block_template *f, *fastest; - fastest = NULL; + fastest = XOR_SELECT_TEMPLATE(NULL); -#ifdef XOR_SELECT_TEMPLATE - fastest = XOR_SELECT_TEMPLATE(fastest); if (fastest) { printk(KERN_INFO "xor: automatically using best " "checksumming function %-10s\n", fastest->name); goto out; } -#endif /* * Note: Since the memory is not actually used for _anything_ but to