]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
octeontx2-pf: Remove unnecessary bounds check
authorSimon Horman <horms@kernel.org>
Mon, 19 Jan 2026 16:39:37 +0000 (16:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Jan 2026 02:28:35 +0000 (18:28 -0800)
commit2ec113ee41b632492baba09f3527a0ae292a747b
tree54c3a94a6d4cda990ab0529b89ad0438f0c28873
parentcd18e8ac030e646ea88bad0200e0e4593a1b11b1
octeontx2-pf: Remove unnecessary bounds check

active_fec is a 2-bit unsigned field, and thus can only have the values
0-3. So checking that it is less than 4 is unnecessary.

Simplify the code by dropping this check.

As it no longer fits well where it is, move FEC_MAX_INDEX to towards the
top of the file. And add the prefix OXT2.  I believe this is more
idiomatic.

Flagged by Smatch as:
  ...//otx2_ethtool.c:1024 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'

No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Link: https://patch.msgid.link/20260119-oob-v1-1-a4147e75e770@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c