Re: [net PATCH] net: phy: aquantia: fix wrong GENMASK define for LED_PROV_ACT_STRETCH

From: Christophe JAILLET
Date: Sun May 11 2025 - 06:07:30 EST


Le 11/05/2025 à 11:57, Russell King (Oracle) a écrit :
On Sun, May 11, 2025 at 11:06:17AM +0200, Christian Marangi wrote:
In defining VEND1_GLOBAL_LED_PROV_ACT_STRETCH there was a typo where the
GENMASK definition was swapped.

Fix it to prevent any kind of misconfiguration if ever this define will
be used in the future.

I thought GENMASK() was supposed to warn about this kind of thing. I've
questioned in the past whether GENMASK() is better than defining fields
with hex numbers, and each time I see another repeat of this exact case,
I re-question whether GENMASK() actually gives much benefit over hex
numbers because it's just too easy to get the two arguments to
GENMASK() swapped and it's never obvious that's happened.

I don't remember there being a dribble of patches in the past
correcting bitfields defined using hex numbers, but that seems common
with GENMASK().


There is a compile time check, but in this case
VEND1_GLOBAL_LED_PROV_ACT_STRETCH looks unused. So it is never expanded and compiled.

CJ