The branch stable/14 has been updated by zlei:

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

commit a1075ea2a31428daac5e7308630ec68a8d4dbf6d
Author:     Zhenlei Huang <z...@freebsd.org>
AuthorDate: 2024-09-03 10:25:32 +0000
Commit:     Zhenlei Huang <z...@freebsd.org>
CommitDate: 2024-09-30 04:44:26 +0000

    qat(4): Stop checking for failures from malloc(M_WAITOK)
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
    
    (cherry picked from commit 866dc4bd81398b478daefe4b7447b92422b4a06c)
---
 sys/dev/qat/qat_common/adf_freebsd_dev_processes.c | 8 --------
 sys/dev/qat/qat_common/adf_freebsd_uio.c           | 8 --------
 sys/dev/qat/qat_common/adf_freebsd_uio_cleanup.c   | 3 ---
 sys/dev/qat/qat_hw/qat_4xxxvf/adf_drv.c            | 5 -----
 4 files changed, 24 deletions(-)

diff --git a/sys/dev/qat/qat_common/adf_freebsd_dev_processes.c 
b/sys/dev/qat/qat_common/adf_freebsd_dev_processes.c
index b8a17344bdea..a70f25d57dcb 100644
--- a/sys/dev/qat/qat_common/adf_freebsd_dev_processes.c
+++ b/sys/dev/qat/qat_common/adf_freebsd_dev_processes.c
@@ -146,8 +146,6 @@ adf_processes_open(struct cdev *dev, int oflags, int 
devtype, struct thread *td)
                return ENXIO;
        }
        prv_data = malloc(sizeof(*prv_data), M_QAT, M_WAITOK | M_ZERO);
-       if (!prv_data)
-               return ENOMEM;
        INIT_LIST_HEAD(&prv_data->list);
        error = devfs_set_cdevpriv(prv_data, adf_processes_release);
        if (error) {
@@ -573,14 +571,8 @@ adf_state_open(struct cdev *dev, int oflags, int devtype, 
struct thread *td)
        int ret = 0;
 
        prv_data = malloc(sizeof(*prv_data), M_QAT, M_WAITOK | M_ZERO);
-       if (!prv_data)
-               return -ENOMEM;
        entry_proc_events =
            malloc(sizeof(struct entry_proc_events), M_QAT, M_WAITOK | M_ZERO);
-       if (!entry_proc_events) {
-               free(prv_data, M_QAT);
-               return -ENOMEM;
-       }
        mtx_lock(&mtx);
        prv_data->cdev = dev;
        prv_data->cdev->si_drv1 = prv_data;
diff --git a/sys/dev/qat/qat_common/adf_freebsd_uio.c 
b/sys/dev/qat/qat_common/adf_freebsd_uio.c
index c109fc79b0f4..64efde72b4b8 100644
--- a/sys/dev/qat/qat_common/adf_freebsd_uio.c
+++ b/sys/dev/qat/qat_common/adf_freebsd_uio.c
@@ -199,10 +199,6 @@ adf_alloc_bundle(struct adf_accel_dev *accel_dev, int 
bundle_nr)
 
        accel = accel_dev->accel;
        handle = malloc(sizeof(*handle), M_QAT, M_WAITOK | M_ZERO);
-       if (!handle) {
-               printf("ERROR in adf_alloc_bundle %d\n", __LINE__);
-               return ENOMEM;
-       }
        handle->accel = accel;
        handle->bundle = bundle_nr;
 
@@ -294,10 +290,6 @@ adf_uio_mmap_single(struct cdev *dev,
        /* Adding pid to bundle list */
        instance_rings =
            malloc(sizeof(*instance_rings), M_QAT, M_WAITOK | M_ZERO);
-       if (!instance_rings) {
-               printf("QAT: Memory allocation error - line: %d\n", __LINE__);
-               return -ENOMEM;
-       }
        instance_rings->user_pid = curproc->p_pid;
        instance_rings->ring_mask = 0;
        mutex_lock(&bundle->list_lock);
diff --git a/sys/dev/qat/qat_common/adf_freebsd_uio_cleanup.c 
b/sys/dev/qat/qat_common/adf_freebsd_uio_cleanup.c
index 6fb4cf0bf2f7..954e31c683ce 100644
--- a/sys/dev/qat/qat_common/adf_freebsd_uio_cleanup.c
+++ b/sys/dev/qat/qat_common/adf_freebsd_uio_cleanup.c
@@ -123,9 +123,6 @@ get_orphan_bundle(int bank,
 
        orphan_bundle =
            malloc(sizeof(*orphan_bundle), M_QAT, M_WAITOK | M_ZERO);
-       if (!orphan_bundle)
-               return ENOMEM;
-
        csr_base = accel->bar->virt_addr;
        orphan_bundle->csr_base = csr_base;
        orphan_bundle->bank = bank;
diff --git a/sys/dev/qat/qat_hw/qat_4xxxvf/adf_drv.c 
b/sys/dev/qat/qat_hw/qat_4xxxvf/adf_drv.c
index 05a99ae43ab7..9b66ae4b2370 100644
--- a/sys/dev/qat/qat_hw/qat_4xxxvf/adf_drv.c
+++ b/sys/dev/qat/qat_hw/qat_4xxxvf/adf_drv.c
@@ -117,11 +117,6 @@ adf_attach(device_t dev)
        }
        /* Allocate and configure device configuration structure */
        hw_data = malloc(sizeof(*hw_data), M_QAT_4XXXVF, M_WAITOK | M_ZERO);
-       if (!hw_data) {
-               ret = -ENOMEM;
-               goto out_err;
-       }
-
        accel_dev->hw_device = hw_data;
        adf_init_hw_data_4xxxiov(accel_dev->hw_device);
        accel_pci_dev->revid = pci_get_revid(dev);

Reply via email to