nvme: clean up test_nvme_ctrlr_fail
Replace unnecessary allocation with a stack variable. Clears up a potential NULL pointer dereference indicated by scan-build. Change-Id: I81a7591729b0f1630bab9ce378716bd2369d6b85 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
84cfc97fdf
commit
b177c56881
@ -159,22 +159,14 @@ nvme_allocate_request(void *payload, uint32_t payload_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_nvme_ctrlr_fail()
|
test_nvme_ctrlr_fail(void)
|
||||||
{
|
{
|
||||||
struct nvme_controller *ctrlr = NULL;
|
struct nvme_controller ctrlr = {};
|
||||||
struct nvme_qpair qpair = {};
|
|
||||||
uint64_t phys_addr = 0;
|
|
||||||
|
|
||||||
ctrlr = nvme_malloc("nvme_controller", sizeof(struct nvme_controller),
|
ctrlr.num_io_queues = 0;
|
||||||
64, &phys_addr);
|
nvme_ctrlr_fail(&ctrlr);
|
||||||
CU_ASSERT(ctrlr != NULL);
|
|
||||||
|
|
||||||
ctrlr->num_io_queues = 0;
|
CU_ASSERT(ctrlr.is_failed == true);
|
||||||
ctrlr->adminq = qpair;
|
|
||||||
nvme_ctrlr_fail(ctrlr);
|
|
||||||
|
|
||||||
CU_ASSERT(ctrlr->is_failed == true);
|
|
||||||
nvme_free(ctrlr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user