/* Most attribute values have a known length even when they do have a length field. This knowledge can be used via this function to verify that the length field matches the expected value.  */
static int wlp_check_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, enum wlp_attr_type type, unsigned len)
/* Most attribute values have a known length even when they do have a length field. This knowledge can be used via this function to verify that the length field matches the expected value.  */
static int wlp_check_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, enum wlp_attr_type type, unsigned len)
{
	struct device *dev = &wlp->rc->uwb_dev.dev;
	if (le16_to_cpu(hdr->type) != type) {
		dev_err(dev, "WLP: unexpected header type. Expected "
			"%u, got %u.\n", type, le16_to_cpu(hdr->type));
		return -EINVAL;
	}
	if (le16_to_cpu(hdr->length) != len) {
		dev_err(dev, "WLP: unexpected length in header. Expected "
			"%u, got %u.\n", len, le16_to_cpu(hdr->length));
		return -EINVAL;
	}
	return 0;
}