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 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..

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux