From: Jakub Kicinski <kuba@kernel.org>
To: Kory Maincent <kory.maincent@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Oleksij Rempel <o.rempel@pengutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net] net: pse-pd: pd692x0: Fix power limit retrieval
Date: Tue, 18 Feb 2025 18:33:08 -0800 [thread overview]
Message-ID: <20250218183308.5101d50c@kernel.org> (raw)
In-Reply-To: <20250217171500.0fd4a519@kmaincent-XPS-13-7390>
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..
next prev parent reply other threads:[~2025-02-19 2:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 13:48 [PATCH net] net: pse-pd: pd692x0: Fix power limit retrieval Kory Maincent
2025-02-17 15:24 ` Andrew Lunn
2025-02-17 16:15 ` Kory Maincent
2025-02-19 2:33 ` Jakub Kicinski [this message]
2025-02-19 2:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250218183308.5101d50c@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kory.maincent@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.