mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: linux-kernel@vger.kernel.org, lersek@redhat.com
Subject: [PATCH] allow padlock module to load without xcrypt support
Date: Wed, 20 Jun 2012 11:22:19 +0200	[thread overview]
Message-ID: <1340184139-6718-1-git-send-email-lersek@redhat.com> (raw)

Lack of (enabled) hardware is arguably not a module initialization error,
thus it should not cause problems during the boot process.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Please CC me on any comments. Thanks.

 drivers/crypto/padlock-aes.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 37b2e94..a42a308 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -516,11 +516,11 @@ static int __init padlock_init(void)
 	struct cpuinfo_x86 *c = &cpu_data(0);
 
 	if (!x86_match_cpu(padlock_cpu_id))
-		return -ENODEV;
+		return 0;
 
 	if (!cpu_has_xcrypt_enabled) {
 		printk(KERN_NOTICE PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n");
-		return -ENODEV;
+		return 0;
 	}
 
 	if ((ret = crypto_register_alg(&aes_alg)))
@@ -554,6 +554,9 @@ aes_err:
 
 static void __exit padlock_fini(void)
 {
+	if (!x86_match_cpu(padlock_cpu_id) || !cpu_has_xcrypt_enabled)
+		return;
+
 	crypto_unregister_alg(&cbc_aes_alg);
 	crypto_unregister_alg(&ecb_aes_alg);
 	crypto_unregister_alg(&aes_alg);
-- 
1.7.1


                 reply	other threads:[~2012-06-20  9:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340184139-6718-1-git-send-email-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®