[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250218183308.5101d50c@kernel.org>
Date: Tue, 18 Feb 2025 18:33:08 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Kory Maincent <kory.maincent@...tlin.com>
Cc: Andrew Lunn <andrew@...n.ch>, Oleksij Rempel <o.rempel@...gutronix.de>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, Andrew Lunn <andrew+netdev@...n.ch>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net] net: pse-pd: pd692x0: Fix power limit retrieval
On Mon, 17 Feb 2025 17:15:00 +0100 Kory Maincent wrote:
> > > - return pd692x0_pi_get_pw_from_table(buf.data[2], buf.data[3]);
> > > + return pd692x0_pi_get_pw_from_table(buf.data[0], buf.data[1]);
> >
> > Would the issue of been more obvious if some #defines were used,
> > rather than magic numbers?
>
> We would need lots of defines as the offset of the useful data can
> change between each command. Don't know if it would have been better.
>
> On my current patch priority series.
> git grep "buf\." drivers/net/pse-pd/pd692x0.c | wc -l
> 29
I guess it'd take a bigger rewrite, so I'll apply.
But I fully agree with Andrew that the current coding is very error
prone :( If you ever need to add more message you should start from
refactoring this code..
Powered by blists - more mailing lists