Re: [PATCH v2] rtrs-clt: silence kbuild test inconsistent intenting smatch warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 20, 2020 at 1:38 AM Jason Gunthorpe <jgg@xxxxxxxx> wrote:
>
> On Tue, May 19, 2020 at 07:29:15AM -0700, Bart Van Assche wrote:
> > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > index 468fdd0d8713..8dfa56dc32bc 100644
> > +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > @@ -727,18 +727,13 @@ struct path_it {
> >       struct rtrs_clt_sess *(*next_path)(struct path_it *it);
> >  };
> >
> > -#define do_each_path(path, clt, it) {                                        \
> > -     path_it_init(it, clt);                                          \
> > -     rcu_read_lock();                                                \
> > -     for ((it)->i = 0; ((path) = ((it)->next_path)(it)) &&           \
> > -                       (it)->i < (it)->clt->paths_num;               \
> > +#define for_each_path(path, clt, it)                                 \
> > +     for (path_it_init((it), (clt)), rcu_read_lock(), (it)->i = 0;   \
> > +          (((path) = ((it)->next_path)(it)) &&                       \
> > +           (it)->i < (it)->clt->paths_num) ||                        \
> > +                  (path_it_deinit(it), rcu_read_unlock(), 0);        \
> >            (it)->i++)
>
> That is nicer, even better to write it with some inlines..

You mean pass a callback to an inline function that would iterate?
>
> Jason



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux