Index: head/sys/dev/mps/mps_user.c =================================================================== --- head/sys/dev/mps/mps_user.c +++ head/sys/dev/mps/mps_user.c @@ -699,11 +699,6 @@ if (cmd->len > 0) { buf = malloc(cmd->len, M_MPSUSER, M_WAITOK|M_ZERO); - if(!buf) { - mps_printf(sc, "Cannot allocate memory %s %d\n", - __func__, __LINE__); - return (ENOMEM); - } cm->cm_data = buf; cm->cm_length = cmd->len; } else { @@ -930,25 +925,20 @@ if (cm->cm_length != 0) { cm->cm_data = malloc(cm->cm_length, M_MPSUSER, M_WAITOK | M_ZERO); - if (cm->cm_data == NULL) { - mps_dprint(sc, MPS_FAULT, "%s: alloc failed for IOCTL " - "passthru length %d\n", __func__, cm->cm_length); - } else { - cm->cm_flags = MPS_CM_FLAGS_DATAIN; - if (data->DataOutSize) { - cm->cm_flags |= MPS_CM_FLAGS_DATAOUT; - err = copyin(PTRIN(data->PtrDataOut), - cm->cm_data, data->DataOutSize); - } else if (data->DataDirection == - MPS_PASS_THRU_DIRECTION_WRITE) { - cm->cm_flags = MPS_CM_FLAGS_DATAOUT; - err = copyin(PTRIN(data->PtrData), - cm->cm_data, data->DataSize); - } - if (err != 0) - mps_dprint(sc, MPS_FAULT, "%s: failed to copy " - "IOCTL data from user space\n", __func__); + cm->cm_flags = MPS_CM_FLAGS_DATAIN; + if (data->DataOutSize) { + cm->cm_flags |= MPS_CM_FLAGS_DATAOUT; + err = copyin(PTRIN(data->PtrDataOut), + cm->cm_data, data->DataOutSize); + } else if (data->DataDirection == + MPS_PASS_THRU_DIRECTION_WRITE) { + cm->cm_flags = MPS_CM_FLAGS_DATAOUT; + err = copyin(PTRIN(data->PtrData), + cm->cm_data, data->DataSize); } + if (err != 0) + mps_dprint(sc, MPS_FAULT, "%s: failed to copy " + "IOCTL data from user space\n", __func__); } cm->cm_flags |= MPS_CM_FLAGS_SGE_SIMPLE; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; @@ -2090,11 +2080,6 @@ break; case MPSIO_READ_CFG_PAGE: mps_page = malloc(page_req->len, M_MPSUSER, M_WAITOK | M_ZERO); - if(!mps_page) { - mps_printf(sc, "Cannot allocate memory %s %d\n", - __func__, __LINE__); - return (ENOMEM); - } error = copyin(page_req->buf, mps_page, sizeof(MPI2_CONFIG_PAGE_HEADER)); if (error) @@ -2113,11 +2098,6 @@ break; case MPSIO_READ_EXT_CFG_PAGE: mps_page = malloc(ext_page_req->len, M_MPSUSER, M_WAITOK|M_ZERO); - if(!mps_page) { - mps_printf(sc, "Cannot allocate memory %s %d\n", - __func__, __LINE__); - return (ENOMEM); - } error = copyin(ext_page_req->buf, mps_page, sizeof(MPI2_CONFIG_EXTENDED_PAGE_HEADER)); if (error) @@ -2131,11 +2111,6 @@ break; case MPSIO_WRITE_CFG_PAGE: mps_page = malloc(page_req->len, M_MPSUSER, M_WAITOK|M_ZERO); - if(!mps_page) { - mps_printf(sc, "Cannot allocate memory %s %d\n", - __func__, __LINE__); - return (ENOMEM); - } error = copyin(page_req->buf, mps_page, page_req->len); if (error) break;