Re: [PATCH v2] rcu: Don't return a value from rcu_assign_pointer()
From: Joe Perches
Date: Mon May 27 2019 - 13:24:45 EST
On Mon, 2019-05-27 at 09:10 -0700, Paul E. McKenney wrote:
> On Mon, May 27, 2019 at 10:49:57AM +0200, Andrea Parri wrote:
> > Quoting Paul [1]:
> >
> > "Given that a quick (and perhaps error-prone) search of the uses
> > of rcu_assign_pointer() in v5.1 didn't find a single use of the
> > return value, let's please instead change the documentation and
> > implementation to eliminate the return value."
> >
> > [1] https://lkml.kernel.org/r/20190523135013.GL28207@xxxxxxxxxxxxx
>
> Queued, thank you!
>
> Adding the checkpatch maintainers on CC as well. The "do { } while
> (0)" prevents the return value from being used, by design. Given the
> checkpatch complaint, is there some better way to achieve this?
Not sure what the checkpatch complaint is here.
Reading the link above, there seems to be a compiler warning.
Perhaps a statement expression macro with no return value?
#define rcu_assign_pointer(p, v) ({ (p) = (v); ; })