Skip to contentSkip to conversation

Improve system log messaging in ccp-crypto

PATCH In review Hook, Gary 2 participants 4 messages Jul 10, 2019 – Jul 26, 2019

Subsystems (2)
lore
Share & tools
lore

Hook, Gary

author
#0 lore raw

cover Improve system log messaging in ccp-crypto

From: Gary R Hook <[email protected]>

Add a prefix to any messages logged by the ccp-crypto module, and add a notice if the module fails to load in the case that no CCPs are defined.

Gary R Hook (2):
crypto: ccp - Include the module name in system log messages
crypto: ccp - Log an error message when ccp-crypto fails to load

 drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
 drivers/crypto/ccp/ccp-crypto.h      | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 crypto: ccp - Include the module name in system log messages

Redefine pr_fmt so that the module name is prefixed to every log message produced by the ccp-crypto module

---
 drivers/crypto/ccp/ccp-crypto.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-crypto.h +4 -0
index a4a593dddfd6..c5d471b2ac1b 100644
@@ -24,6 +24,10 @@
 #include <crypto/akcipher.h>
 #include <crypto/internal/rsa.h>
 
+/* We want the module name in front of our messages */
+#undef pr_fmt
+#define	pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
+
 #define	CCP_LOG_LEVEL	KERN_INFO
 
 #define CCP_CRA_PRIORITY	300
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 crypto: ccp - Log an error message when ccp-crypto fails to load

In reply to Hook, Gary

If there are no CCP devices on the system, ccp-crypto will not load. Write a message to the system log clarifying the reason for the failure of the modprobe operation

---
 drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/ccp/ccp-crypto-main.c +3 -1
index 44a9917a4a6a..5b61c440dff0 100644
@@ -405,8 +405,10 @@ static int ccp_crypto_init(void)
 	int ret;
 
 	ret = ccp_present();
-	if (ret)
+	if (ret) {
+		pr_err("Cannot load: there are no available CCPs\n");
 		return ret;
+	}
 
 	spin_lock_init(&req_queue_lock);
 	INIT_LIST_HEAD(&req_queue.cmds);
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to Hook, Gary
Quoted 6 lines · Gary

From: Gary R Hook <[email protected]>

Add a prefix to any messages logged by the ccp-crypto module, and add a notice if the module fails to load in the case that no CCPs are defined.

Quoted 7 lines

Gary R Hook (2):
crypto: ccp - Include the module name in system log messages
crypto: ccp - Log an error message when ccp-crypto fails to load

drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
drivers/crypto/ccp/ccp-crypto.h | 4 ++++

2 files changed, 7 insertions(+), 1 deletion(-)

All applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt