/* Returns: NULL if the TLV is not found, otherwise a pointer to it. If the sizes don't match, an error is printed and NULL returned.  */
static const struct i2400m_tlv_hdr* i2400m_tlv_find(struct i2400m *i2400m, const struct i2400m_tlv_hdr *tlv_hdr, size_t size, enum i2400m_tlv tlv_type, ssize_t tlv_size)
/* Returns: NULL if the TLV is not found, otherwise a pointer to it. If the sizes don't match, an error is printed and NULL returned.  */
static const struct i2400m_tlv_hdr* i2400m_tlv_find(struct i2400m *i2400m, const struct i2400m_tlv_hdr *tlv_hdr, size_t size, enum i2400m_tlv tlv_type, ssize_t tlv_size)
{
	ssize_t match;
	struct device *dev = i2400m_dev(i2400m);
	const struct i2400m_tlv_hdr *tlv = NULL;
	while ((tlv = i2400m_tlv_buffer_walk(i2400m, tlv_hdr, size, tlv))) {
		match = i2400m_tlv_match(tlv, tlv_type, tlv_size);
		if (match == 0)
			break;
		if (match > 0)
			dev_warn(dev, "TLV type 0x%04x found with size "
				 "mismatch (%zu vs %zu needed)\n",
				 tlv_type, match, tlv_size);
	}
	return tlv;
}