mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Inconsistency in scripts/checkpatch.pl
@ 2017-06-30  1:26 Larry Finger
  2017-06-30  3:12 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Larry Finger @ 2017-06-30  1:26 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: LKML

Andy and Joe,

In some new rtlwifi code, I get the following for one of the new macros:

CHECK: Macro argument '__h2c' may be better as '(__h2c)' to avoid precedence issues
#45005: FILE: 
drivers/net/wireless/realtek/rtlwifi/halmac/halmac_original_h2c_nic.h:1163:
+#define AOAC_RSVD_PAGE3_GET_LOC_AOAC_REPORT(__h2c)                     \
+       LE_BITS_TO_4BYTE(__h2c + 0X00, 16, 8)

When I make that change, I get

CHECK: No space is necessary after a cast
#45004: FILE: 
drivers/net/wireless/realtek/rtlwifi/halmac/halmac_original_h2c_nic.h:1162:
+       LE_BITS_TO_4BYTE((__h2c) + 0X00, 16, 8)

Which CHECK should I fix? To my eye, the second form is the false positive.

Larry

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Inconsistency in scripts/checkpatch.pl
  2017-06-30  1:26 Inconsistency in scripts/checkpatch.pl Larry Finger
@ 2017-06-30  3:12 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-06-30  3:12 UTC (permalink / raw)
  To: Larry Finger, Andy Whitcroft; +Cc: LKML

On Thu, 2017-06-29 at 20:26 -0500, Larry Finger wrote:
> Andy and Joe,
> 
> In some new rtlwifi code, I get the following for one of the new macros:
> 
> CHECK: Macro argument '__h2c' may be better as '(__h2c)' to avoid precedence issues
> #45005: FILE: 
> drivers/net/wireless/realtek/rtlwifi/halmac/halmac_original_h2c_nic.h:1163:
> +#define AOAC_RSVD_PAGE3_GET_LOC_AOAC_REPORT(__h2c)                     \
> +       LE_BITS_TO_4BYTE(__h2c + 0X00, 16, 8)
> 
> When I make that change, I get
> 
> CHECK: No space is necessary after a cast
> #45004: FILE: 
> drivers/net/wireless/realtek/rtlwifi/halmac/halmac_original_h2c_nic.h:1162:
> +       LE_BITS_TO_4BYTE((__h2c) + 0X00, 16, 8)
> 
> Which CHECK should I fix?

The first.  Only if you want to.

>  To my eye, the second form is the false positive.

I agree.  Ignore the 2nd warning for awhile.
.
A few trivial notes:

o 0X00 is kinda ugly to me.  0x00 is nicer.
o I presume that 0x00 could be a #define somewhere
o AOAC_RSVD_PAGE3_GET_LOC_AOAC_REPORT is a rather
  long identifier at 35 chars.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-30  3:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30  1:26 Inconsistency in scripts/checkpatch.pl Larry Finger
2017-06-30  3:12 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®