Message ID | 20230321114721.20531-1-wsa+renesas@sang-engineering.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1730936wrt; Tue, 21 Mar 2023 04:58:28 -0700 (PDT) X-Google-Smtp-Source: AK7set8CDZ5Xd6feuUT6keiiomoeD1yTU8tLI1+SpIjq4J25dPdHluvhGM0Hu3VTjuQcWNyPWJqP X-Received: by 2002:a17:90b:1bcf:b0:23b:bd09:7f0b with SMTP id oa15-20020a17090b1bcf00b0023bbd097f0bmr2672051pjb.30.1679399908223; Tue, 21 Mar 2023 04:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679399908; cv=none; d=google.com; s=arc-20160816; b=QXorni84C5V+7yAE3XzH5zC4kHQdiBxbHiYPBuILZS7ckximBlEHTTqYtKRFF76lil 8tPAtsMh42DlRQncZ0XiWtJwMTKPJdywgf23IvZXM9eaYBXoZms86RhyIaxAdVRiSxdO Zd2ABsQZ8H4e3KsehIxJdRi3vBh/YGF2jYPd3ZInus6AtzMCEgj/jbgQhjyhAZQAPEl0 oXbxfzr85H8zvz6oNCc6HzLde6d7+qdTmVqODRxCr9yle4sKR+1I2ODujZTyo2Gr6fSZ TfXkrU7AL7Sp6Q7jRNHbq2ozqLlDKhU++9oeMv9dnkYozgnFr1H6PtdD0gONVhnw9KBH ZM7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=w7UB3peEZtEOhiXCc06cXRk36j4ci1lhUihM0hF5w08=; b=MMvYH4YIJZB0pOBww3u1n3JQNb6W9hDlzYCmSWp5qDG9S/Xx8vy2gi9yIBVdq1VSdL zOlOvE74YKB/YLXhQkAITU0xPnICCTAUVY/a83Q4guA8/tuVJ4rxgu6MnRId/XuwTmYF swPKYfw8NcdX9XzUJb6R1iY4n6jbXHLTqnwtfwnnuPUstLlp7FmZz7Qr93/cBVaE216r lCt+hWD/nW3bxXhnIAR1MyRekplhIV/h/DKRP53Ix4yLhxljXmwcpP30ZUwvN+Dt72mi rg6Cqgb/uUTE6G2phDlaFSXGtP1mXB6ZBvJEoovFGvI0pZwjlgP1sc1uHWLnsA9Vbd1d i13A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=Mdn6sMDG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go10-20020a17090b03ca00b00233c4b78195si18494415pjb.4.2023.03.21.04.58.13; Tue, 21 Mar 2023 04:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=Mdn6sMDG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjCULrd (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Tue, 21 Mar 2023 07:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbjCULra (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Mar 2023 07:47:30 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5EB11E1D2 for <linux-kernel@vger.kernel.org>; Tue, 21 Mar 2023 04:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=4CSu9xMPWM+eFxOVPsRfLMFc6kq Mw0cf0OnDqlkwByY=; b=Mdn6sMDG0YOGHdiYIC0cUTUH/zQA1/Vk2tT40vCv8RF ABeS/Va1JGhP/tZ9poahTmTt6qvH2uL75+yXtAWFUskB35V/P+iab0YMsvXV9ViA 7RFURdov8Cp5pLk4hU25ivVxGVLwWUpsxTkRw/CI96bJoR4kxTPpFAXKugYR0MrM = Received: (qmail 1264852 invoked from network); 21 Mar 2023 12:47:24 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 21 Mar 2023 12:47:24 +0100 X-UD-Smtp-Session: l3s3148p1@qwBmm2f33Icujnv6 From: Wolfram Sang <wsa+renesas@sang-engineering.com> To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang <wsa+renesas@sang-engineering.com>, Steve Glendinning <steve.glendinning@shawell.net>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-kernel@vger.kernel.org Subject: [PATCH net-next] smsc911x: remove superfluous variable init Date: Tue, 21 Mar 2023 12:47:20 +0100 Message-Id: <20230321114721.20531-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760978438202717937?= X-GMAIL-MSGID: =?utf-8?q?1760978438202717937?= |
Series |
[net-next] smsc911x: remove superfluous variable init
|
|
Commit Message
Wolfram Sang
March 21, 2023, 11:47 a.m. UTC
phydev is assigned a value right away, no need to initialize it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/net/ethernet/smsc/smsc911x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Wolfram, On Tue, Mar 21, 2023 at 12:50 PM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > phydev is assigned a value right away, no need to initialize it. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Thanks for your patch! Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- a/drivers/net/ethernet/smsc/smsc911x.c > +++ b/drivers/net/ethernet/smsc/smsc911x.c > @@ -1016,7 +1016,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev) > static int smsc911x_mii_probe(struct net_device *dev) > { > struct smsc911x_data *pdata = netdev_priv(dev); > - struct phy_device *phydev = NULL; > + struct phy_device *phydev; > int ret; > > phydev = phy_find_first(pdata->mii_bus); Nit: perhaps combine this assignment with the variable declaration? Gr{oetje,eeting}s, Geert
> > struct smsc911x_data *pdata = netdev_priv(dev); > > - struct phy_device *phydev = NULL; > > + struct phy_device *phydev; > > int ret; > > > > phydev = phy_find_first(pdata->mii_bus); > > Nit: perhaps combine this assignment with the variable declaration? I thought about it but found this version to be easier readable. Thanks!
On Tue, 21 Mar 2023 15:38:31 +0100 Wolfram Sang wrote: > > > struct smsc911x_data *pdata = netdev_priv(dev); > > > - struct phy_device *phydev = NULL; > > > + struct phy_device *phydev; > > > int ret; > > > > > > phydev = phy_find_first(pdata->mii_bus); > > > > Nit: perhaps combine this assignment with the variable declaration? > > I thought about it but found this version to be easier readable. +1 Calling functions which need their return value error-checked as part of the variable declaration should be against the kernel coding style IMHO.
On Tue, 2023-03-21 at 15:38 +0100, Wolfram Sang wrote: > > > struct smsc911x_data *pdata = netdev_priv(dev); > > > - struct phy_device *phydev = NULL; > > > + struct phy_device *phydev; > > > int ret; > > > > > > phydev = phy_find_first(pdata->mii_bus); > > > > Nit: perhaps combine this assignment with the variable declaration? > > I thought about it but found this version to be easier readable. This patch does not apply cleanly to net-next, please rebase and resping. Thanks! Paolo
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 25e867b74185..037a2b6b89d7 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -1016,7 +1016,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev) static int smsc911x_mii_probe(struct net_device *dev) { struct smsc911x_data *pdata = netdev_priv(dev); - struct phy_device *phydev = NULL; + struct phy_device *phydev; int ret; phydev = phy_find_first(pdata->mii_bus);