lkml.org 
[lkml]   [2020]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -next] iwlwifi: pcie: Use bitwise instead of arithmetic operator for flags
From
Date
On Tue, 2020-05-05 at 20:19 -0700, Joe Perches wrote:
> On Wed, 2020-05-06 at 11:07 +0800, Samuel Zou wrote:
> > This silences the following coccinelle warning:
> >
> > "WARNING: sum of probable bitmasks, consider |"
>
> I suggest instead ignoring bad and irrelevant warnings.
>
> PREFIX_LEN is 32 not 0x20 or BIT(5)
> PCI_DUMP_SIZE is 352
>
> > diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
> []
> > @@ -109,9 +109,9 @@ void iwl_trans_pcie_dump_regs(struct iwl_trans *trans)
> >
> > /* Alloc a max size buffer */
> > alloc_size = PCI_ERR_ROOT_ERR_SRC + 4 + PREFIX_LEN;
> > - alloc_size = max_t(u32, alloc_size, PCI_DUMP_SIZE + PREFIX_LEN);
> > - alloc_size = max_t(u32, alloc_size, PCI_MEM_DUMP_SIZE + PREFIX_LEN);
> > - alloc_size = max_t(u32, alloc_size, PCI_PARENT_DUMP_SIZE + PREFIX_LEN);
> > + alloc_size = max_t(u32, alloc_size, PCI_DUMP_SIZE | PREFIX_LEN);
> > + alloc_size = max_t(u32, alloc_size, PCI_MEM_DUMP_SIZE | PREFIX_LEN);
> > + alloc_size = max_t(u32, alloc_size, PCI_PARENT_DUMP_SIZE | PREFIX_LEN);
> >
> > buf = kmalloc(alloc_size, GFP_ATOMIC);
> > if (!buf)

Yeah, those macros are clearly not bitmasks. I'm dropping this patch.

--
Cheers,
Luca.

\
 
 \ /
  Last update: 2020-05-06 15:51    [W:0.040 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site