{
int rc;
struct nvme_sqe *cmd_create_cq;
+ u16 length = 1 + (ctrl->reg->cap & 0xffff);
+ if (length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
+ length = NVME_PAGE_SIZE / sizeof(struct nvme_cqe);
- rc = nvme_init_cq(ctrl, cq, q_idx, NVME_PAGE_SIZE / sizeof(struct nvme_cqe));
+ rc = nvme_init_cq(ctrl, cq, q_idx, length);
if (rc) {
goto err;
}
{
int rc;
struct nvme_sqe *cmd_create_sq;
+ u16 length = 1 + (ctrl->reg->cap & 0xffff);
+ if (length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
+ length = NVME_PAGE_SIZE / sizeof(struct nvme_cqe);
- rc = nvme_init_sq(ctrl, sq, q_idx, NVME_PAGE_SIZE / sizeof(struct nvme_cqe), cq);
+ rc = nvme_init_sq(ctrl, sq, q_idx, length, cq);
if (rc) {
goto err;
}