From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3994DC072A2 for ; Wed, 15 Nov 2023 18:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YtY21r6MDatE15h9y7QQLRQeBz/1rvvZh7hxPFVdABA=; b=EbOXax8f9VdI8X 8Qvq0VFYvcauxVYQdJyWlXz5MPQAf+zMHvYa8u1GAaWfQrPY6N1lCs40P/XQSRzHfsdNxfPhww3cl pbTGQa1R39BmNgEQvzXmGroR/pote/WOHjDP85m9uOFhIOBWg8Ym9V4XUWM+sTU8uzA8Vvb27V8FQ FCN7F6olOtKejszPFgD7g5sUf9hkbB7teijhhUePJsZ9LCiAE5/UkQ7OkRaneATt8wYMCcdb+N5aG kY0yKH8C5o4AZU6pL/s5+a5TJQyb2DaEXkTVNh7VK2N9uXuroNp0T9N3D7OL0aTEWBrJ/vKFJw4Gp 3QxuNHGIHjiKPwcSskaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r3KTm-001VDl-19; Wed, 15 Nov 2023 18:19:10 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r3KTi-001VCZ-32 for linux-arm-kernel@lists.infradead.org; Wed, 15 Nov 2023 18:19:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 29114B8191F; Wed, 15 Nov 2023 18:19:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8FAC433C8; Wed, 15 Nov 2023 18:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700072344; bh=eU8VRI5fJn+sZhMvBxa7JGVZvziW9p/UioRXXO8E7O0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c7hagV6YqD6T5UB6NLTwzcYXzJgaClLID3j2jf6CM6YHdE1xA3rBpEQje3Vf6inB2 AMVQa7+fBTiFzyI0MxKW7yfuJ+oISjiDtnaeXMvEOX4oonXlqDdJHh09xarfWbYoPZ 5c924RBeBQT9tPEErHqSbL6a3qcDjhLu3U13uSm1Jg/88TdGsBTeVp1CDyVRRNTJuX M0ypqhcAzRCDcvEyTVCt4kq9LcGUUOX7JtqdRXnrO299+cqu3EwBbxeH9UfRpMam2Q PaK0+HWWxd5KTfGdkU3J7WpY4Xl6FH7T8LPkSMeJOhUFhs5Yj5FUD+9V1cmFLrqDue pSDd+gFT7tvVQ== Date: Wed, 15 Nov 2023 18:18:58 +0000 From: Simon Horman To: Romain Gantois Cc: davem@davemloft.net, Rob Herring , Krzysztof Kozlowski , Jakub Kicinski , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko , Andy Gross , Bjorn Andersson , Konrad Dybcio Subject: Re: [PATCH net-next v3 4/8] net: qualcomm: ipqess: Add Ethtool ops to IPQESS port netdevices Message-ID: <20231115181858.GY74656@kernel.org> References: <20231114105600.1012056-1-romain.gantois@bootlin.com> <20231114105600.1012056-5-romain.gantois@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231114105600.1012056-5-romain.gantois@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231115_101907_274780_508B2606 X-CRM114-Status: GOOD ( 19.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 14, 2023 at 11:55:54AM +0100, Romain Gantois wrote: > The IPQESS driver registers one netdevice for each front-facing switch > port. Add support for several ethtool operations to these netdevices. > > Signed-off-by: Romain Gantois Hi Romain, some more minor feedback from my side. > --- > drivers/net/ethernet/qualcomm/ipqess/Makefile | 2 +- > .../ethernet/qualcomm/ipqess/ipqess_ethtool.c | 245 ++++++++++++++++++ > .../ethernet/qualcomm/ipqess/ipqess_port.c | 1 + > .../ethernet/qualcomm/ipqess/ipqess_port.h | 3 + > 4 files changed, 250 insertions(+), 1 deletion(-) > create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c ... > diff --git a/drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c b/drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c ... > +static int ipqess_port_set_eee(struct net_device *dev, struct ethtool_eee *eee) > +{ > + struct ipqess_port *port = netdev_priv(dev); > + int ret; > + u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port->index); > + struct qca8k_priv *priv = port->sw->priv; > + u32 lpi_ctl1; nit: Please consider using reverse xmas tree - longest line to shortest - for local variable declarations in networking code. > + > + /* Port's PHY and MAC both need to be EEE capable */ > + if (!dev->phydev || !port->pl) > + return -ENODEV; > + > + mutex_lock(&priv->reg_mutex); > + lpi_ctl1 = qca8k_read(priv, QCA8K_REG_EEE_CTRL, &lpi_ctl1); > + if (lpi_ctl1 < 0) { lpi_ctl1 is unsigned, it can never be less than zero. As flagged by Smatch and Coccinelle. I think this should probably be (completely untested!): ret = qca8k_read(priv, QCA8K_REG_EEE_CTRL, &lpi_ctl1); if (ret < 0) { Which would also resolve the issue immediately below too. > + mutex_unlock(&priv->reg_mutex); > + return ret; It seems that ret is used uninitialised here. Flagged by clang-16 W=1 builds. > + } ... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel