]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: pcs: xpcs: Return EINVAL in the internal methods
authorSerge Semin <fancer.lancer@gmail.com>
Thu, 22 Feb 2024 17:58:22 +0000 (20:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:01:43 +0000 (13:01 +0200)
commit0f22f30f79a82bfab42680a1bbfc1c90d1f5a6de
tree212ac90c9def401625d666e1b71c032ba12fcae2
parent9a16a0d03305c651bcb76b5db9d2ba47fa26a686
net: pcs: xpcs: Return EINVAL in the internal methods

[ Upstream commit f5151005d379d9ce42e327fd3b2d2aaef61cda81 ]

In particular the xpcs_soft_reset() and xpcs_do_config() functions
currently return -1 if invalid auto-negotiation mode is specified. That
value might be then passed to the generic kernel subsystems which require
a standard kernel errno value. Even though the erroneous conditions are
very specific (memory corruption or buggy driver implementation) using a
hard-coded -1 literal doesn't seem correct anyway especially when it comes
to passing it higher to the network subsystem or printing to the system
log.  Convert the hard-coded error values to -EINVAL then.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/pcs/pcs-xpcs.c