git: 6a2a385507c7 - main - kern_fail: Stop checking for failures from fp_malloc(M_WAITOK)

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Tue, 03 Sep 2024 10:26:43 UTC
The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a2a385507c79abaa9db9eabfdd827362f3dc7ed

commit 6a2a385507c79abaa9db9eabfdd827362f3dc7ed
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-09-03 10:25:16 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-09-03 10:25:16 +0000

    kern_fail: Stop checking for failures from fp_malloc(M_WAITOK)
    
    `fp_malloc` is defined as a macro that redirects to `malloc`.
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
---
 sys/kern/kern_fail.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_fail.c b/sys/kern/kern_fail.c
index 883b664aef0d..258268bb874f 100644
--- a/sys/kern/kern_fail.c
+++ b/sys/kern/kern_fail.c
@@ -479,11 +479,10 @@ fail_point_init(struct fail_point *fp, const char *fmt, ...)
 
 	/* Allocate the name and fill it in. */
 	name = fp_malloc(n + 1, M_WAITOK);
-	if (name != NULL) {
-		va_start(ap, fmt);
-		vsnprintf(name, n + 1, fmt, ap);
-		va_end(ap);
-	}
+	va_start(ap, fmt);
+	vsnprintf(name, n + 1, fmt, ap);
+	va_end(ap);
+
 	fp->fp_name = name;
 	fp->fp_location = "";
 	fp->fp_flags |= FAIL_POINT_DYNAMIC_NAME;