On Thu, Mar 12, 2026 at 09:03:03AM -0700, Stephen Hemminger wrote:
> On Thu, 12 Mar 2026 09:15:26 +0000
> Bruce Richardson <[email protected]> wrote:
> 
> > On Wed, Mar 11, 2026 at 05:23:36PM -0700, Stephen Hemminger wrote:
> > > The driver was open coding TAILQ_FOREACH_SAFE() in a manner
> > > that triggered warnings. Replace it with the standard one
> > > from bsd queue.h.
> > > 
> > > Signed-off-by: Stephen Hemminger <[email protected]>
> > > ---
> > >  drivers/raw/ifpga/base/ifpga_enumerate.c | 4 +---
> > >  drivers/raw/ifpga/base/opae_hw_api.h     | 7 +++++++
> > >  2 files changed, 8 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/raw/ifpga/base/ifpga_enumerate.c 
> > > b/drivers/raw/ifpga/base/ifpga_enumerate.c
> > > index 61eb6601ea..085fb6db40 100644
> > > --- a/drivers/raw/ifpga/base/ifpga_enumerate.c
> > > +++ b/drivers/raw/ifpga/base/ifpga_enumerate.c
> > > @@ -725,9 +725,7 @@ static void dfl_fpga_enum_info_free(struct 
> > > dfl_fpga_enum_info *info)
> > >           return;
> > >  
> > >   /* remove all device feature lists in the list. */
> > > - for (dfl = TAILQ_FIRST(&info->dfls);
> > > -         dfl && (tmp = TAILQ_NEXT(dfl, node), 1);
> > > -         dfl = tmp) {
> > > + TAILQ_FOREACH_SAFE(dfl, &info->dfls, node, tmp) {
> > >           TAILQ_REMOVE(&info->dfls, dfl, node);
> > >           opae_free(dfl);
> > >   }
> > > diff --git a/drivers/raw/ifpga/base/opae_hw_api.h 
> > > b/drivers/raw/ifpga/base/opae_hw_api.h
> > > index 57750022dd..63cb616731 100644
> > > --- a/drivers/raw/ifpga/base/opae_hw_api.h
> > > +++ b/drivers/raw/ifpga/base/opae_hw_api.h
> > > @@ -10,6 +10,13 @@
> > >  #include <stdio.h>
> > >  #include <sys/queue.h>
> > >  
> > > +#ifndef TAILQ_FOREACH_SAFE
> > > +#define  TAILQ_FOREACH_SAFE(var, head, field, tvar)                      
> > > \
> > > + for ((var) = TAILQ_FIRST((head));                               \
> > > +     (var) && ((tvar) = TAILQ_NEXT((var), field), 1);            \
> > > +     (var) = (tvar))
> > > +#endif
> > > +  
> > 
> > I am curious as to how this is not causing warnings but the original code
> > is. Have we got builds where we are triggering this macro definition, or is
> > ever build tested already got the define?
> 
> You have to ask to enable comma warnings, I think it is currently disabled
> at the driver level.

Yes, it's disabled for the drivers, but if we enable it for raw/ifpga
driver, how come this macro doesn't give the warning when it uses the exact
same structure as the original code?

Reply via email to