From 7a70d9a1cf112c0bdb42800d264d48f34089e3e8 Mon Sep 17 00:00:00 2001 From: Corentin Labbe Date: Fri, 4 Mar 2022 07:36:48 +0000 Subject: crypto: xilinx: prevent probing on non-xilinx hardware The zynqmp-sha driver is always loaded and register its algorithm even on platform which do not have the proper hardware. This lead to a stacktrace due to zynqmp-sha3-384 failing its crypto self tests. So check if hardware is present via the firmware API call get_version. While at it, simplify the platform_driver by using module_platform_driver() Furthermore the driver should depend on ZYNQMP_FIRMWARE since it cannot work without it. Fixes: 7ecc3e34474b ("crypto: xilinx - Add Xilinx SHA3 driver") Signed-off-by: Corentin Labbe Signed-off-by: Herbert Xu --- drivers/crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/crypto/Kconfig') diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index bf4e55e730aa..597559ec2057 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -810,7 +810,7 @@ config CRYPTO_DEV_ZYNQMP_AES config CRYPTO_DEV_ZYNQMP_SHA3 bool "Support for Xilinx ZynqMP SHA3 hardware accelerator" - depends on ARCH_ZYNQMP + depends on ZYNQMP_FIRMWARE select CRYPTO_SHA3 help Xilinx ZynqMP has SHA3 engine used for secure hash calculation. -- cgit v1.2.3-59-g8ed1b