This patch fixes an unused variable warning from the compiler when the driver is being compiled without PCI support in the kernel. changes since v1: - capture the platform_register_driver error code as well - actually return the (last) error code - swapped registration to do PCI first as that's just for development boards anyway, so in case both are done we want the platform error or no error at all if that passes - also fixes some indentation issue in the affected code Signed-off-by: Pascal van Leeuwen <pvanleeuwen@xxxxxxxxxxxxxx> --- drivers/crypto/inside-secure/safexcel.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index e12a2a3..2331b31 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -1505,29 +1505,29 @@ static int __init safexcel_init(void) { int rc; -#if IS_ENABLED(CONFIG_OF) - /* Register platform driver */ - platform_driver_register(&crypto_safexcel); +#if IS_ENABLED(CONFIG_PCI) + /* Register PCI driver */ + rc = pci_register_driver(&safexcel_pci_driver); #endif -#if IS_ENABLED(CONFIG_PCI) - /* Register PCI driver */ - rc = pci_register_driver(&safexcel_pci_driver); +#if IS_ENABLED(CONFIG_OF) + /* Register platform driver */ + rc = platform_driver_register(&crypto_safexcel); #endif - return 0; + return rc; } static void __exit safexcel_exit(void) { #if IS_ENABLED(CONFIG_OF) - /* Unregister platform driver */ - platform_driver_unregister(&crypto_safexcel); + /* Unregister platform driver */ + platform_driver_unregister(&crypto_safexcel); #endif #if IS_ENABLED(CONFIG_PCI) - /* Unregister PCI driver if successfully registered before */ - pci_unregister_driver(&safexcel_pci_driver); + /* Unregister PCI driver if successfully registered before */ + pci_unregister_driver(&safexcel_pci_driver); #endif } -- 1.8.3.1