From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DB8E146A94; Thu, 11 Apr 2024 10:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712831167; cv=none; b=EyONrX2YVWrjTyzkREvhJc4Evha/EG4LGeDOf8uROkbrt80PmT7ZRB7U130P9Wp6AKl1nOAIxfzYXePr2JbceDzlZI6tBd4OV4RP4caGpG2pNrJnrnkOk7eaf9cMiVSeTQIqBANQbcPyb88lvudjKEJ6QEM6wFyKAdcUxwsHsH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712831167; c=relaxed/simple; bh=ZDdl6uJpmQqchYslGZFMsE678HQdRtZFdqUR+UWihZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/2wGGrN/kLl4/xF3Fer1+cldr2D+FSi4ooyTazbhvmLMJgtHMEtjDay+8OQRV6fvRQAmzuXX1YT7oMMZDNnyIXCXZ/XKqh6oqt2zRjWlYkgpHf8ztwivXv6v+jM6QSoUI81R1D74qsM7byzCoUT525A+eDufXbQa4xHnD1udmk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Q9COViky; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Q9COViky" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468A0C433F1; Thu, 11 Apr 2024 10:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712831166; bh=ZDdl6uJpmQqchYslGZFMsE678HQdRtZFdqUR+UWihZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9COVikyQt6XuBz1EqGtLSm1SeFJwUSDImO29xp8BVByV2B+a5kqVX36jmO2pfbW4 0MS+lXBuQIhZD29odbmDnJcaIfUSEwBzCP9WThKK4uboyTKShUjXEEMSbGBJftONdp zIKSuGwr2ShD2jbYCjx3fHuXG4PMbikE02OwJ+sI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Serge Semin , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 6.6 031/114] net: pcs: xpcs: Return EINVAL in the internal methods Date: Thu, 11 Apr 2024 11:55:58 +0200 Message-ID: <20240411095417.809228461@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095416.853744210@linuxfoundation.org> References: <20240411095416.853744210@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Serge Semin [ 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 Tested-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/pcs/pcs-xpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 4dbc21f604f20..f0f41e86a4fb3 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -293,7 +293,7 @@ static int xpcs_soft_reset(struct dw_xpcs *xpcs, dev = MDIO_MMD_VEND2; break; default: - return -1; + return -EINVAL; } ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET); @@ -891,7 +891,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, return ret; break; default: - return -1; + return -EINVAL; } if (compat->pma_config) { -- 2.43.0