Commit 212ef6f2 authored by Pascal van Leeuwen's avatar Pascal van Leeuwen Committed by Herbert Xu

crypto: inside-secure - Fix unused variable warning when CONFIG_PCI=n

This patch fixes an unused variable warning from the compiler when the
driver is being compiled without PCI support in the kernel.

Fixes: 625f269a ("crypto: inside-secure - add support for...")
Signed-off-by: default avatarPascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5fc194ea
...@@ -1789,32 +1789,50 @@ static struct pci_driver safexcel_pci_driver = { ...@@ -1789,32 +1789,50 @@ static struct pci_driver safexcel_pci_driver = {
}; };
#endif #endif
static int __init safexcel_init(void) /* Unfortunately, we have to resort to global variables here */
{ #if IS_ENABLED(CONFIG_PCI)
int rc; int pcireg_rc = -EINVAL; /* Default safe value */
#endif
#if IS_ENABLED(CONFIG_OF) #if IS_ENABLED(CONFIG_OF)
/* Register platform driver */ int ofreg_rc = -EINVAL; /* Default safe value */
platform_driver_register(&crypto_safexcel);
#endif #endif
static int __init safexcel_init(void)
{
#if IS_ENABLED(CONFIG_PCI) #if IS_ENABLED(CONFIG_PCI)
/* Register PCI driver */ /* Register PCI driver */
rc = pci_register_driver(&safexcel_pci_driver); pcireg_rc = pci_register_driver(&safexcel_pci_driver);
#endif #endif
return 0; #if IS_ENABLED(CONFIG_OF)
/* Register platform driver */
ofreg_rc = platform_driver_register(&crypto_safexcel);
#if IS_ENABLED(CONFIG_PCI)
/* Return success if either PCI or OF registered OK */
return pcireg_rc ? ofreg_rc : 0;
#else
return ofreg_rc;
#endif
#else
#if IS_ENABLED(CONFIG_PCI)
return pcireg_rc;
#else
return -EINVAL;
#endif
#endif
} }
static void __exit safexcel_exit(void) static void __exit safexcel_exit(void)
{ {
#if IS_ENABLED(CONFIG_OF) #if IS_ENABLED(CONFIG_OF)
/* Unregister platform driver */ /* Unregister platform driver */
if (!ofreg_rc)
platform_driver_unregister(&crypto_safexcel); platform_driver_unregister(&crypto_safexcel);
#endif #endif
#if IS_ENABLED(CONFIG_PCI) #if IS_ENABLED(CONFIG_PCI)
/* Unregister PCI driver if successfully registered before */ /* Unregister PCI driver if successfully registered before */
if (!pcireg_rc)
pci_unregister_driver(&safexcel_pci_driver); pci_unregister_driver(&safexcel_pci_driver);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment