linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning
@ 2019-09-06 15:22 Arnd Bergmann
  2019-09-06 15:22 ` [PATCH 2/2] crypto: hisilicon - avoid unused function warning Arnd Bergmann
  2019-09-06 16:08 ` [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Pascal Van Leeuwen
  0 siblings, 2 replies; 9+ messages in thread
From: Arnd Bergmann @ 2019-09-06 15:22 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Antoine Tenart
  Cc: Arnd Bergmann, Pascal van Leeuwen, Ard Biesheuvel, Kees Cook,
	linux-crypto, linux-kernel

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] crypto: hisilicon - avoid unused function warning
  2019-09-06 15:22 [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Arnd Bergmann
@ 2019-09-06 15:22 ` Arnd Bergmann
  2019-09-13  9:17   ` Herbert Xu
  2019-09-06 16:08 ` [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Pascal Van Leeuwen
  1 sibling, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2019-09-06 15:22 UTC (permalink / raw)
  To: Zhou Wang, Herbert Xu, David S. Miller
  Cc: Arnd Bergmann, Jonathan Cameron, Hao Fang, Kenneth Lee,
	linux-crypto, linux-kernel

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 <arnd@arndb.de>
---
 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)
 {
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning
  2019-09-06 15:22 [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Arnd Bergmann
  2019-09-06 15:22 ` [PATCH 2/2] crypto: hisilicon - avoid unused function warning Arnd Bergmann
@ 2019-09-06 16:08 ` Pascal Van Leeuwen
  2019-09-06 18:39   ` Arnd Bergmann
  1 sibling, 1 reply; 9+ messages in thread
From: Pascal Van Leeuwen @ 2019-09-06 16:08 UTC (permalink / raw)
  To: Arnd Bergmann, Herbert Xu, David S. Miller, Antoine Tenart
  Cc: Ard Biesheuvel, Kees Cook, linux-crypto, linux-kernel

> -----Original Message-----
> From: Arnd Bergmann <arnd@arndb.de>
> Sent: Friday, September 6, 2019 5:22 PM
> 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
> 
> 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
>

This seems like it just ignores the problem by not allowing compile testing
anymore? Somehow that does not feel right ...

>  	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
>

The whole point was NOT to use regular #ifdefs such that the code can
be compile tested without needing to switch configurations.
There is already a different solution in the works involving some empty
inline stubs for those pci routines, please see an earlier mail by Herbert
titled "PCI: Add stub pci_irq_vector and others". 

>  		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
>
I'm working on a fix for this part already, seems to involve a bit
more than just removing the int declaration ...

> 
>  #if IS_ENABLED(CONFIG_OF)
>  		/* Register platform driver */
> --
> 2.20.0

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2019-09-06 18:39 UTC (permalink / raw)
  To: Pascal Van Leeuwen
  Cc: Herbert Xu, David S. Miller, Antoine Tenart, Ard Biesheuvel,
	Kees Cook, linux-crypto, linux-kernel

On Fri, Sep 6, 2019 at 6:08 PM Pascal Van Leeuwen
<pvanleeuwen@verimatrix.com> wrote:

> >
> >  config CRYPTO_DEV_SAFEXCEL
> >       tristate "Inside Secure's SafeXcel cryptographic engine driver"
> > -     depends on OF || PCI || COMPILE_TEST
> > +     depends on OF || PCI
> >
>
> This seems like it just ignores the problem by not allowing compile testing
> anymore? Somehow that does not feel right ...

No, it just ignores the uninteresting case. You can compile-test this on
any architecture by turning on OF.

> >       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
> >
>
> The whole point was NOT to use regular #ifdefs such that the code can
> be compile tested without needing to switch configurations.
> There is already a different solution in the works involving some empty
> inline stubs for those pci routines, please see an earlier mail by Herbert
> titled "PCI: Add stub pci_irq_vector and others".

Ah, good. That should take care of most of the problems. I think
we still need the Kconfig change, unless the safexcel_init()
function is also changed to use if(IS_ENABLED()) checks
instead of #if.

     Arnd

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning
  2019-09-06 18:39   ` Arnd Bergmann
@ 2019-09-06 20:18     ` Pascal Van Leeuwen
  0 siblings, 0 replies; 9+ messages in thread
From: Pascal Van Leeuwen @ 2019-09-06 20:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, David S. Miller, Antoine Tenart, Ard Biesheuvel,
	Kees Cook, linux-crypto, linux-kernel

> -----Original Message-----
> From: Arnd Bergmann <arnd@arndb.de>
> Sent: Friday, September 6, 2019 8:40 PM
> To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>; David S. Miller <davem@davemloft.net>; Antoine
> Tenart <antoine.tenart@bootlin.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Kees Cook
> <keescook@chromium.org>; linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning
> 
> On Fri, Sep 6, 2019 at 6:08 PM Pascal Van Leeuwen
> <pvanleeuwen@verimatrix.com> wrote:
> 
> > >
> > >  config CRYPTO_DEV_SAFEXCEL
> > >       tristate "Inside Secure's SafeXcel cryptographic engine driver"
> > > -     depends on OF || PCI || COMPILE_TEST
> > > +     depends on OF || PCI
> > >
> >
> > This seems like it just ignores the problem by not allowing compile testing
> > anymore? Somehow that does not feel right ...
> 
> No, it just ignores the uninteresting case. You can compile-test this on
> any architecture by turning on OF.
> 
You are entirely correct. Because of the COMPILE_TEST it could be compiled
without either OF or PCI support, which makes no sense whatsoever ...

> > >       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
> > >
> >
> > The whole point was NOT to use regular #ifdefs such that the code can
> > be compile tested without needing to switch configurations.
> > There is already a different solution in the works involving some empty
> > inline stubs for those pci routines, please see an earlier mail by Herbert
> > titled "PCI: Add stub pci_irq_vector and others".
> 
> Ah, good. That should take care of most of the problems. I think
> we still need the Kconfig change, unless the safexcel_init()
> function is also changed to use if(IS_ENABLED()) checks
> instead of #if.
> 
>      Arnd
>
Yes, I agree.


Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] crypto: hisilicon - avoid unused function warning
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2019-09-13  9:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Zhou Wang, David S. Miller, Jonathan Cameron, Hao Fang,
	Kenneth Lee, linux-crypto, linux-kernel

On Fri, Sep 06, 2019 at 05:22:30PM +0200, Arnd Bergmann wrote:
> 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 <arnd@arndb.de>
> ---
>  drivers/crypto/hisilicon/zip/zip_main.c | 2 ++
>  1 file changed, 2 insertions(+)

Please find a way to fix this warning without reducing compiler
coverage.  I prefer to see any compile issues immediately rather
than through automated build testing.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] crypto: hisilicon - avoid unused function warning
  2019-09-13  9:17   ` Herbert Xu
@ 2019-09-19  8:11     ` Zhou Wang
  2019-09-19 13:48       ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Zhou Wang @ 2019-09-19  8:11 UTC (permalink / raw)
  To: Herbert Xu, Arnd Bergmann
  Cc: David S. Miller, Jonathan Cameron, Hao Fang, Kenneth Lee,
	linux-crypto, linux-kernel

On 2019/9/13 17:17, Herbert Xu wrote:
> On Fri, Sep 06, 2019 at 05:22:30PM +0200, Arnd Bergmann wrote:
>> 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 <arnd@arndb.de>
>> ---
>>  drivers/crypto/hisilicon/zip/zip_main.c | 2 ++
>>  1 file changed, 2 insertions(+)
> 
> Please find a way to fix this warning without reducing compiler
> coverage.  I prefer to see any compile issues immediately rather
> than through automated build testing.
> 
> Thanks,
>

Sorry for missing this patch.

Seems other drivers also do like using #ifdef. Do you mean something like this:
#ifdef CONFIG_PCI_IOV
sriov_enable()
...
#else
/* stub */
sriov_enable()
...
#endif

Best,
Zhou




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] crypto: hisilicon - avoid unused function warning
  2019-09-19  8:11     ` Zhou Wang
@ 2019-09-19 13:48       ` Herbert Xu
  2019-09-19 14:07         ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2019-09-19 13:48 UTC (permalink / raw)
  To: Zhou Wang
  Cc: Arnd Bergmann, David S. Miller, Jonathan Cameron, Hao Fang,
	Kenneth Lee, linux-crypto, linux-kernel

On Thu, Sep 19, 2019 at 04:11:13PM +0800, Zhou Wang wrote:
> On 2019/9/13 17:17, Herbert Xu wrote:
> > On Fri, Sep 06, 2019 at 05:22:30PM +0200, Arnd Bergmann wrote:
> >> 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 <arnd@arndb.de>
> >> ---
> >>  drivers/crypto/hisilicon/zip/zip_main.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> > 
> > Please find a way to fix this warning without reducing compiler
> > coverage.  I prefer to see any compile issues immediately rather
> > than through automated build testing.
> > 
> > Thanks,
> >
> 
> Sorry for missing this patch.
> 
> Seems other drivers also do like using #ifdef. Do you mean something like this:
> #ifdef CONFIG_PCI_IOV
> sriov_enable()
> ...
> #else
> /* stub */
> sriov_enable()
> ...
> #endif

For an unused warning the unused compiler attribute would seem
to be the way to go.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] crypto: hisilicon - avoid unused function warning
  2019-09-19 13:48       ` Herbert Xu
@ 2019-09-19 14:07         ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2019-09-19 14:07 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Zhou Wang, David S. Miller, Jonathan Cameron, Hao Fang,
	Kenneth Lee, open list:HARDWARE RANDOM NUMBER GENERATOR CORE,
	linux-kernel

On Thu, Sep 19, 2019 at 3:48 PM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Thu, Sep 19, 2019 at 04:11:13PM +0800, Zhou Wang wrote:
> > On 2019/9/13 17:17, Herbert Xu wrote:
> > > On Fri, Sep 06, 2019 at 05:22:30PM +0200, Arnd Bergmann wrote:
> > >> 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 <arnd@arndb.de>
> > >> ---
> > >>  drivers/crypto/hisilicon/zip/zip_main.c | 2 ++
> > >>  1 file changed, 2 insertions(+)
> > >
> > > Please find a way to fix this warning without reducing compiler
> > > coverage.  I prefer to see any compile issues immediately rather
> > > than through automated build testing.
> > >
> > > Thanks,
> > >
> >
> > Sorry for missing this patch.
> >
> > Seems other drivers also do like using #ifdef. Do you mean something like this:
> > #ifdef CONFIG_PCI_IOV
> > sriov_enable()
> > ...
> > #else
> > /* stub */
> > sriov_enable()
> > ...
> > #endif
>
> For an unused warning the unused compiler attribute would seem
> to be the way to go.

I sent an update patch now that also removes the first #ifdef, plus one
that enables compile-testing on x86 (with some caveats).

      Arnd

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-19 14:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 15:22 [PATCH 1/2] crypto: inside-secure - fix uninitialized-variable warning Arnd Bergmann
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

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).