/* Registers the protocol <proto> */
void protocol_register(struct protocol *proto)
{
+ int sock_domain = proto->fam->sock_domain;
+
+ BUG_ON(sock_domain < 0 || sock_domain >= AF_CUST_MAX);
+
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
LIST_APPEND(&protocols, &proto->list);
- if (proto->fam->sock_domain >= 0 && proto->fam->sock_domain < AF_CUST_MAX)
- __protocol_by_family[proto->fam->sock_domain]
- [proto->sock_type == SOCK_DGRAM]
- [proto->ctrl_type == SOCK_DGRAM] = proto;
+ __protocol_by_family[sock_domain]
+ [proto->sock_type == SOCK_DGRAM]
+ [proto->ctrl_type == SOCK_DGRAM] = proto;
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
}