From: Arnd Bergmann <arnd@arndb.de>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Antoine Tenart <antoine.tenart@bootlin.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Pascal van Leeuwen <pvanleeuwen@verimatrix.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Kees Cook <keescook@chromium.org>,
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 [thread overview]
Message-ID: <20190906152250.1450649-1-arnd@arndb.de> (raw)
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 <arnd@arndb.de>
---
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 */
--
2.20.0
next reply other threads:[~2019-09-06 15:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 15:22 Arnd Bergmann [this message]
2019-09-06 15:22 ` [PATCH 2/2] crypto: hisilicon - avoid unused function warning Arnd Bergmann
2019-09-13 9:17 ` Herbert Xu
2019-09-19 8:11 ` Zhou Wang
2019-09-19 13:48 ` Herbert Xu
2019-09-19 14:07 ` Arnd Bergmann
2019-09-06 16:08 ` [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Pascal Van Leeuwen
2019-09-06 18:39 ` Arnd Bergmann
2019-09-06 20:18 ` Pascal Van Leeuwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190906152250.1450649-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=antoine.tenart@bootlin.com \
--cc=ard.biesheuvel@linaro.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pvanleeuwen@verimatrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).