From: Theo Buehler Subject: Re: relayd: fix dead store To: Rafael Sadowski Cc: tech@openbsd.org Date: Mon, 29 Dec 2025 11:14:43 +0100 On Mon, Dec 29, 2025 at 10:44:47AM +0100, Rafael Sadowski wrote: > First c is never used so check if carp_group_find is NULL and return. > > carp.c:64:7: warning: Although the value stored to 'c' is used in the > enclosing expression, the value is never actually read from 'c' > [deadcode.DeadSt ores] > 64 | if ((c = carp_group_find(group)) == NULL) > > > diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c > index 6a6a55a0fbb..34b6b6785a2 100644 > --- a/usr.sbin/relayd/carp.c > +++ b/usr.sbin/relayd/carp.c > @@ -61,29 +61,31 @@ carp_demote_init(char *group, int force) > struct carpgroup *c; > int level; > > - if ((c = carp_group_find(group)) == NULL) { I would just do this and leave the rest as it is: - if ((c = carp_group_find(group)) == NULL) { + if (carp_group_find(group) == NULL) { [...] > + if (carp_group_find(group) == NULL) { If you do want to unindent, then you need to check for != NULL here. (If a carp group is found, do nothing and succeed, otherwise create a new one and add it to the carpgroups queue) > + return (0); > + }