]> git.baikalelectronics.ru Git - kernel.git/commit
IB/uverbs: New macro to set pointers to NULL if length is 0 in INIT_UDATA()
authorRoland Dreier <roland@purestorage.com>
Thu, 19 Dec 2013 16:37:03 +0000 (08:37 -0800)
committerRoland Dreier <roland@purestorage.com>
Fri, 20 Dec 2013 18:53:44 +0000 (10:53 -0800)
commit2a7c38c689b0bc6ea253fd454eb32ea45ea08bce
tree94b6871a378f9a643f268c1e5c6ccd563fd65fa6
parent2dabb19621f756035c9bc2d4f2f4c7af84fcd186
IB/uverbs: New macro to set pointers to NULL if length is 0 in INIT_UDATA()

Trying to have a ternary operator to choose between NULL (or 0) and the
real pointer value in invocations leads to an impossible choice between
a sparse error about a literal 0 used as a NULL pointer, and a gcc
warning about "pointer/integer type mismatch in conditional expression."

Rather than clutter the source with more casts, move the ternary
operator into a new INIT_UDATA_BUF_OR_NULL() macro, which makes it
easier to use and simplifies its callers.

Reported-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/core/uverbs.h
drivers/infiniband/core/uverbs_main.c