Skip to contentSkip to conversation

tpm: remove kmalloc failure error message

PATCH Superseded Colin Ian King 1 participant 2 messages Apr 30, 2025

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: remove kmalloc failure error message

The kmalloc failure message is just noise. Remove it and replace -EFAULT with -ENOMEM as standard for out of memory allocation error returns.

---

V1: remove trailing space after \n
V2: remove entire message, originally just removed a trailing space
V3: replace -EFAULT with -ENOMEM

---
 drivers/char/tpm/eventlog/tpm1.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/char/tpm/eventlog/tpm1.c +1 -4
index 12ee42a31c71..773e9e537991 100644
@@ -257,11 +257,8 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
 	    (unsigned char *)(v + sizeof(struct tcpa_event));
 
 	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
-	if (!eventname) {
-		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
-		       __func__);
+	if (!eventname)
 		return -EFAULT;
-	}
 
 	/* 1st: PCR */
 	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));
Signature · 1 line
2.49.0
#1 lore raw

NAK, sent the wrong patch! Doh.

Quoted 32 lines · Colin Ian King

The kmalloc failure message is just noise. Remove it and replace -EFAULT with -ENOMEM as standard for out of memory allocation error returns.

---

V1: remove trailing space after \n
V2: remove entire message, originally just removed a trailing space
V3: replace -EFAULT with -ENOMEM

---
  drivers/char/tpm/eventlog/tpm1.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/char/tpm/eventlog/tpm1.c +1 -4
index 12ee42a31c71..773e9e537991 100644
@@ -257,11 +257,8 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
  	    (unsigned char *)(v + sizeof(struct tcpa_event));
 
  	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
-	if (!eventname) {
-		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
-		       __func__);
+	if (!eventname)
  		return -EFAULT;
-	}
 
  	/* 1st: PCR */
  	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));