git: 736dfe255d89 - stable/13 - hptnr(4): Stop checking for failures from malloc(M_WAITOK)

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Mon, 30 Sep 2024 05:08:27 UTC
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=736dfe255d8918188eb5b6cc4b64b0297dc6f15d

commit 736dfe255d8918188eb5b6cc4b64b0297dc6f15d
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-09-03 10:25:29 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-09-30 05:05:36 +0000

    hptnr(4): Stop checking for failures from malloc(M_WAITOK)
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
    
    (cherry picked from commit a3ec5d3ee7579a26790a86ca4c074512946ab964)
    (cherry picked from commit c860df902b6d010cb18490580c776c4b0a6a9123)
---
 sys/dev/hptnr/hptnr_osm_bsd.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c
index 067b8530cd3e..d605cf7712f3 100644
--- a/sys/dev/hptnr/hptnr_osm_bsd.c
+++ b/sys/dev/hptnr/hptnr_osm_bsd.c
@@ -165,7 +165,6 @@ static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
 			f->tag, f->count, f->size, f->count*f->size));
 		for (i=0; i<f->count; i++) {
 			p = (void **)malloc(f->size, M_DEVBUF, M_WAITOK);
-			if (!p)	return (ENXIO);
 			*p = f->head;
 			f->head = p;
 		}
@@ -1389,10 +1388,6 @@ static void hpt_final_init(void *dummy)
 
 		for (i=0; i<os_max_queue_comm; i++) {
 			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
-			if (!ext) {
-				os_printk("Can't alloc cmdext(%d)", i);
-				return ;
-			}
 			ext->vbus_ext = vbus_ext;
 			ext->next = vbus_ext->cmdext_list;
 			vbus_ext->cmdext_list = ext;
@@ -1611,19 +1606,14 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, stru
 
 		if (ioctl_args.nInBufferSize) {
 			ioctl_args.lpInBuffer = malloc(ioctl_args.nInBufferSize, M_DEVBUF, M_WAITOK);
-			if (!ioctl_args.lpInBuffer)
-				goto invalid;
 			if (copyin((void*)piop->lpInBuffer,
 					ioctl_args.lpInBuffer, piop->nInBufferSize))
 				goto invalid;
 		}
 	
-		if (ioctl_args.nOutBufferSize) {
+		if (ioctl_args.nOutBufferSize)
 			ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
-			if (!ioctl_args.lpOutBuffer)
-				goto invalid;
-		}
-		
+
 		hpt_do_ioctl(&ioctl_args);
 	
 		if (ioctl_args.result==HPT_IOCTL_RESULT_OK) {