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
|
||||
test_nvme_ctrlr_fail()
|
||||
test_nvme_ctrlr_fail(void)
|
||||
{
|
||||
struct nvme_controller *ctrlr = NULL;
|
||||
struct nvme_qpair qpair = {};
|
||||
uint64_t phys_addr = 0;
|
||||
struct nvme_controller ctrlr = {};
|
||||
|
||||
ctrlr = nvme_malloc("nvme_controller", sizeof(struct nvme_controller),
|
||||
64, &phys_addr);
|
||||
CU_ASSERT(ctrlr != NULL);
|
||||
ctrlr.num_io_queues = 0;
|
||||
nvme_ctrlr_fail(&ctrlr);
|
||||
|
||||
ctrlr->num_io_queues = 0;
|
||||
ctrlr->adminq = qpair;
|
||||
nvme_ctrlr_fail(ctrlr);
|
||||
|
||||
CU_ASSERT(ctrlr->is_failed == true);
|
||||
nvme_free(ctrlr);
|
||||
CU_ASSERT(ctrlr.is_failed == true);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
Loading…
Reference in New Issue
Block a user