From patchwork Fri Sep 6 15:22:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11135527 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77D8B14ED for ; Fri, 6 Sep 2019 15:23:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63BF3214E0 for ; Fri, 6 Sep 2019 15:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394734AbfIFPXL (ORCPT ); Fri, 6 Sep 2019 11:23:11 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:32893 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387557AbfIFPXL (ORCPT ); Fri, 6 Sep 2019 11:23:11 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1MQ5aw-1hkAou31pA-00M5hb; Fri, 06 Sep 2019 17:22:52 +0200 From: Arnd Bergmann To: Herbert Xu , "David S. Miller" , Antoine Tenart Cc: Arnd Bergmann , Pascal van Leeuwen , Ard Biesheuvel , Kees Cook , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Date: Fri, 6 Sep 2019 17:22:29 +0200 Message-Id: <20190906152250.1450649-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:u547Yb77RHO15kDZX4JTrsBGpb64BliQTLpiUK93UQdkYW08oE8 U2DBhk8auGRevbg3P7wWD0SvYnA8yvjFpmlj0dnVypm38xB4q6uqiIEsjLJnkvV+VfWZ/nG LPPHP0ygT2s0dSdaqNz/YpdCERJ7sgtZOCAIKM3ojYAVvInaQdG3F5KSVWed2QCoolHsgG1 4zpc9UGWFRvw2bjETOBug== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:bnjJzuxwR8o=:zTI8B7lwfhDUvN6/jeDt8r 43CebgMnsG/r6n0jVItqrGmSlJngNg2Mu8B/x5Jk7ejXZta/KEFf7dRmQRb4Y4KwGE0WSRFEb lzTvnFaIz/cR9hSewht/+KDHys+jMtTfVDKDQivgrR6cRNSSDAD7cPowgfXQd5RiVWF2V8zHu U07yvxCeoCtozv+OyBc7ugWnFuH7cAsvJlg4sAh4muUYRrP3seK8QSzbxzE8TYyLjNnBou3uC b40jeQSkGyw2lQ9Mk1CNgGROHw4RD5dBlFq2wgucjaO8zOfMxIKNMnb9YlruQttyvUj7ZN2Dt JOh3RebyFHNpvIO5dILhbmL+OtMhENWhxurStERv++LxeCHuQASNKp2qlOMt6tMnDmreMOl2s 9SqMB5g61bgkeZzwa5MHC11yz9Td4mvowUXSMPVV/jpYG9tFqBvLOIvM1+CoBBpCCy1qXuqM4 N+/Eue3u9uiDFJS7u8ZZ/isl8IBMC8DBuLmBBUpSI1mhQf4RBBvx1Cm6fIiHVg5GqGZ8fy+vk XHTq7YDzgT0LvfCvdR0+i7wzTQ1ExFwteFg0BnQ0Y9B767GgDccSAPWeyc01q8zR+alvOqumx tjrMuDKgRMdAJ+NgT5ys4qyI2vpaqUca/nTJFikmYKpNMVRdOQanqzJiurafJEa+laYjbskGx rwI2Y6dGTIQx7bxQcrLsbh4z917uhgDZ/cm3r23BwCJExQQbN+C+5GRxxjkfl9iWj11vRixkO Hzo9Jivr0r9yiX2y4CmX98SVv19nqUSEDE6XNKLPWEU048MY/pKfPxsOW/YCvCYP4rH5BXoOt RNl+6LGj/Mb9+BSR0MCo0gag9xYlCsSVtDHAWeMu5SXEq4QyPY= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The addition of PCI support introduced multiple randconfig issues. - When PCI is disabled, some external functions are undeclared: drivers/crypto/inside-secure/safexcel.c:944:9: error: implicit declaration of function 'pci_irq_vector' [-Werror,-Wimplicit-function-declaration] - Also, in the same configuration, there is an uninitialized variable: drivers/crypto/inside-secure/safexcel.c:940:6: error: variable 'irq' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] - Finally, the driver fails to completely if both PCI and OF are disabled. Take care of all of the above by adding more checks for CONFIG_PCI and CONFIG_OF. Fixes: 625f269a5a7a ("crypto: inside-secure - add support for PCI based FPGA development board") Signed-off-by: Arnd Bergmann --- drivers/crypto/Kconfig | 2 +- drivers/crypto/inside-secure/safexcel.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 3c4361947f8d..048bc4b393ac 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -719,7 +719,7 @@ source "drivers/crypto/stm32/Kconfig" config CRYPTO_DEV_SAFEXCEL tristate "Inside Secure's SafeXcel cryptographic engine driver" - depends on OF || PCI || COMPILE_TEST + depends on OF || PCI select CRYPTO_LIB_AES select CRYPTO_AUTHENC select CRYPTO_BLKCIPHER diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index e12a2a3a5422..9c0bce77de14 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -938,6 +938,7 @@ static int safexcel_request_ring_irq(void *pdev, int irqid, struct device *dev; if (IS_ENABLED(CONFIG_PCI) && is_pci_dev) { +#ifdef CONFIG_PCI struct pci_dev *pci_pdev = pdev; dev = &pci_pdev->dev; @@ -947,6 +948,7 @@ static int safexcel_request_ring_irq(void *pdev, int irqid, irqid, irq); return irq; } +#endif } else if (IS_ENABLED(CONFIG_OF)) { struct platform_device *plf_pdev = pdev; char irq_name[6] = {0}; /* "ringX\0" */ @@ -960,6 +962,8 @@ static int safexcel_request_ring_irq(void *pdev, int irqid, irq_name, irq); return irq; } + } else { + return -ENXIO; } ret = devm_request_threaded_irq(dev, irq, handler, @@ -1138,6 +1142,7 @@ static int safexcel_probe_generic(void *pdev, safexcel_configure(priv); if (IS_ENABLED(CONFIG_PCI) && priv->version == EIP197_DEVBRD) { +#ifdef CONFIG_PCI /* * Request MSI vectors for global + 1 per ring - * or just 1 for older dev images @@ -1152,6 +1157,7 @@ static int safexcel_probe_generic(void *pdev, dev_err(dev, "Failed to allocate PCI MSI interrupts\n"); return ret; } +#endif } /* Register the ring IRQ handlers and configure the rings */ @@ -1503,7 +1509,9 @@ static struct pci_driver safexcel_pci_driver = { static int __init safexcel_init(void) { +#ifdef CONFIG_PCI int rc; +#endif #if IS_ENABLED(CONFIG_OF) /* Register platform driver */ From patchwork Fri Sep 6 15:22:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11135529 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 054BA924 for ; Fri, 6 Sep 2019 15:23:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E455D2173B for ; Fri, 6 Sep 2019 15:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388396AbfIFPXg (ORCPT ); Fri, 6 Sep 2019 11:23:36 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:57609 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbfIFPXf (ORCPT ); Fri, 6 Sep 2019 11:23:35 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1MC3L9-1i0zgF3HKf-00CQ6I; Fri, 06 Sep 2019 17:23:14 +0200 From: Arnd Bergmann To: Zhou Wang , Herbert Xu , "David S. Miller" Cc: Arnd Bergmann , Jonathan Cameron , Hao Fang , Kenneth Lee , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] crypto: hisilicon - avoid unused function warning Date: Fri, 6 Sep 2019 17:22:30 +0200 Message-Id: <20190906152250.1450649-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190906152250.1450649-1-arnd@arndb.de> References: <20190906152250.1450649-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ltG7Dz//KZqox/ulRWhNwr6SfqbMWug5c/0Q+nuvztJL6BD1vJA EmHRbJP1qdS6LHV68X6MZAAlJG0X0zCKPWwfoQuPwwOy5llTfWPGPYi7Zj45BMLWklrozkT xKHwcH9T6mMO5c4xJ4zh27kGw9XbnlTJfrQ+d9MTzb37QOjUaolFjo9vQHybDkA9bQR7viF ipY6Iu17Pt9qIK8PGMl+Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1uFE00/QaKM=:RpHBHFJ7z5dUtAY8BG6QR+ PXPkJAqDK11VOHtVg5HxdhFLKQ+dv/ca8OlweOakzJCAkjIs3YgBwZ7CfxItKbFwc1fZX0mEc OcDTEGGCOhC36+aAYf71NFoxz3SpDzq3nQhpeF+mjfdvcAvoxbDsDtpBl2XlHPYh6xoxuRILZ G5dVVc1XZC2R2AVqeiHpdOEcoiRLQdFM9s8+MOp843H5/kt0F1znnd1UVz0EBGu5g+qVguH4I 7Wl2S+TCgbGTrCKAmRd6ZBFRsgPeP1kYWxvtZRcy5TcD4CDaikGoShMSiFA2sNDW2S3U2yaLA CJd4Ref3oLxIQvj0l4ozsBEshGINdKP7RjxX8qhsBsi6MF1qS/j0ITT2t1u2ag9uKj4hoDXvC VRcNAaGawP1JaexgXFrCkBOLoO+/2qtx47EQBQGkblceVV0AxOrd2xggwfNlCdsHmdUOYPp3C eofed5/n/MO5X5bZd/LqgZ7LeykztBwws0w6hrCb4dFA4fi5CITEvnIXdAMjtVcafJpWjYBgk wbPZciDvGyvwz5zaaJ9BxVVjZUiv6P2IdEojIhhgKwP1EQFmpeu0jrqICOYr2qOGWiv0JZVdG L/n8IW91EQA0dbjoE5Rq/bZbbFSCD1gPwHiQYQqftj7YLquEvs3eQrs6CPtbdwfqeaYRAY0ty TmH/FXTsdxtA4FDaFdGAu5FNiYLiDUAZJw9Ja/MBhc8op4w685vGfeNZTyv7OlMpnGZH3wvJp A0cVeScbtsRqEh4ZfhgrrGxOLzdsdCCbgPrXQAL6MJRKZR99wONcWBxJHDkCojWZDJXxHXFzY C0fpJCXDkBSmo9cVpJLE9/hEBmaFrKdTfVOanF7laQKELtPrsM= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The only caller of hisi_zip_vf_q_assign() is hidden in an #ifdef, so the function causes a warning when CONFIG_PCI_IOV is disabled: drivers/crypto/hisilicon/zip/zip_main.c:740:12: error: unused function 'hisi_zip_vf_q_assign' [-Werror,-Wunused-function] Move it into the same #ifdef. Fixes: 79e09f30eeba ("crypto: hisilicon - add SRIOV support for ZIP") Signed-off-by: Arnd Bergmann --- drivers/crypto/hisilicon/zip/zip_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 6e0ca75585d4..bd0283c2fa87 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -736,6 +736,7 @@ static int hisi_zip_probe(struct pci_dev *pdev, const struct pci_device_id *id) return ret; } +#ifdef CONFIG_PCI_IOV /* Currently we only support equal assignment */ static int hisi_zip_vf_q_assign(struct hisi_zip *hisi_zip, int num_vfs) { @@ -764,6 +765,7 @@ static int hisi_zip_vf_q_assign(struct hisi_zip *hisi_zip, int num_vfs) return 0; } +#endif static int hisi_zip_clear_vft_config(struct hisi_zip *hisi_zip) {