nvme: assert valid nvme_qpair_construct parameters

Document the assumptions made by qpair_construct using asserts.

These values can't actually be 0 in practice due to the way they are
derived, but scan-build can't see that.  It is also useful to have these
asserts in case of future modifications.

Change-Id: I546c057f5cbe7ccc62acd90b595e423cd450d86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-22 16:28:23 -07:00
parent b177c56881
commit c028633b50

View File

@ -488,6 +488,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint16_t id,
volatile uint32_t *doorbell_base; volatile uint32_t *doorbell_base;
uint64_t phys_addr = 0; uint64_t phys_addr = 0;
nvme_assert(num_entries != 0, ("invalid num_entries\n"));
nvme_assert(num_trackers != 0, ("invalid num_trackers\n"));
qpair->id = id; qpair->id = id;
qpair->num_entries = num_entries; qpair->num_entries = num_entries;