diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 00c7230acfed1de5d0d0330b49af9311747ab642..4bf4bb5b1a8bcf15c5a09df754fa2856942bda7a 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -509,11 +509,12 @@ static int __init pcrypt_init(void)
 
 static void __exit pcrypt_exit(void)
 {
+	crypto_unregister_template(&pcrypt_tmpl);
+
 	pcrypt_fini_padata(&pencrypt);
 	pcrypt_fini_padata(&pdecrypt);
 
 	kset_unregister(pcrypt_kset);
-	crypto_unregister_template(&pcrypt_tmpl);
 }
 
 module_init(pcrypt_init);