Commit c028633b authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent b177c568
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -488,6 +488,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint16_t id,
	volatile uint32_t	*doorbell_base;
	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->num_entries = num_entries;