lkml.org 
[lkml]   [2021]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH rdma-rc] RDMA/netlink: Annotate unused function that is needed for compilation check
On Mon, Nov 08, 2021 at 02:47:19PM +0200, Leon Romanovsky wrote:
> On Mon, Nov 08, 2021 at 08:36:39AM -0400, Jason Gunthorpe wrote:
> > On Sun, Nov 07, 2021 at 08:40:47AM +0200, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@nvidia.com>
> > >
> > > >> drivers/infiniband/core/nldev.c:2543:1: warning: unused function '__chk_RDMA_NL_NLDEV'
> > > MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_NLDEV, 5);
> > > ^
> > >
> > > Fixes: e3bf14bdc17a ("rdma: Autoload netlink client modules")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > > include/rdma/rdma_netlink.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
> > > index 2758d9df71ee..c2a79aeee113 100644
> > > +++ b/include/rdma/rdma_netlink.h
> > > @@ -30,7 +30,7 @@ enum rdma_nl_flags {
> > > * constant as well and the compiler checks they are the same.
> > > */
> > > #define MODULE_ALIAS_RDMA_NETLINK(_index, _val) \
> > > - static inline void __chk_##_index(void) \
> > > + static inline void __maybe_unused __chk_##_index(void) \
> > > { \
> > > BUILD_BUG_ON(_index != _val); \
> > > } \
> >
> > This is a compiler bug, static inline should never need maybe_unsed
>
> I saw many examples like this in arch code.
> For example, commit 4ac214574d2d ("KVM: MMU: mark role_regs and role accessors as maybe unused")
>
> It is better to fix and forget instead of trying to fix clang.

"Because clang reports warnings for unused inlines declared in a .c file,
mark both sets of accessors as __maybe_unused."

Yikes, what a thing to do.

Jason

\
 
 \ /
  Last update: 2021-11-08 13:49    [W:0.063 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site