Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5968591pxj; Wed, 23 Jun 2021 13:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4y0Xns20Kz+Ln53iiHGNUicFMX3oG3dV+lXXMmC5+fgTIFcg8dtgDpTOtXlU09ir2vD7Y X-Received: by 2002:a17:906:bcf4:: with SMTP id op20mr1686375ejb.327.1624478924118; Wed, 23 Jun 2021 13:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624478924; cv=none; d=google.com; s=arc-20160816; b=JiSqU0z33u/nN89ZGYPpnHRlZQCb968gf5Zu3vZIa4bBV+rkTyOjwBf3vJuNfb5ZKt JH7sOkLMOlayvAA7yOzJ63XeCjTuEkVCoYTEIgZsZuE8Dv1S0hIzQcOgWLy79ZPSBhyv G9oq0MtB+DnYKH1lQjVSoYBRI1wFl/Ow/fLFyaSAdv4o6MhKX4vjdkRAhGIaTQILSGUV HEtJZ5ExhvBqoWc8EJzYwFONOr4b/bMGvpAeOgoSo9Cwbrz/8zFq2nYSK/wxqZvIsznE LWp2/yBmgstw+WVL6L60dSDS7SYDedm5KZGTwtU2KW8B4e055WSmiCyLp6LGWpUkBzCu XEig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IG70MoZoSqiFPenmXjBN2WpuGpkp6Lvmd3cBwqO3yfU=; b=i+8p9IEBdwv0mp/VN8d934+hHa2iNA8tfmD1S7M7QxsWeB4S6xjQC5jFuzxTFCmsun mLcpO1+pbOqUscHD7Rylow4avlwifBxOs+hYza2fYrnozU7ZD9wAnvbXxj51YLiytryj 2bJSTxpX16D5VxV2xXJs39XTbzaZPSCPRnEcCZKH31WwA/73etFeat29NboTqBAD/T8d yAelEoHQLVzkMt8bkUBBjWpw6rzALd/1YxPEKfAdIAcHseZdv+yMavspYvhfqejNE6mj GAIzk1bXaJMHWaN6j/1XayHoo5Xxl+fxkm55g2w4CImwb9vHobGI7I6UKJGHGJ/ipdvN AXMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=A6xFJgCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si713804edu.431.2021.06.23.13.08.21; Wed, 23 Jun 2021 13:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=A6xFJgCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhFWUIw (ORCPT + 99 others); Wed, 23 Jun 2021 16:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbhFWUIv (ORCPT ); Wed, 23 Jun 2021 16:08:51 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DA3C061574; Wed, 23 Jun 2021 13:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IG70MoZoSqiFPenmXjBN2WpuGpkp6Lvmd3cBwqO3yfU=; b=A6xFJgCylu/fj4hOTR91ki5aV BWDasOfgOz8YW+o1jP05PuEWXYrn7xO0JzwSeX7AT/RhzYidVxsB9zFr3b7SaLxLWireB+nq+Tsv5 2illYDiuMIPXTiZSmfM3PaY2YUlg8lKBHJwr23gGT9Ii5fU9ydp8xzSF/jdIfY6TDuw2MgDvz1xCD BBWljt6TNPxMqJS0gpajWFndOBASjWkTA3U0oUtJquJKVzPkmceGiGKs1p4qfoB9JUigBUpw6F0Zx 8VVYYNf7Vw9YKFDoxjHpY+471wmUZ+KS9/vh2XVHiDKIFm6hfe8+1/1vPsIqWBt6mAxmBgE/jGU57 kNKEGQ2eg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45280) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lw98f-0006lr-Cf; Wed, 23 Jun 2021 21:06:21 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lw98c-00050g-9k; Wed, 23 Jun 2021 21:06:18 +0100 Date: Wed, 23 Jun 2021 21:06:18 +0100 From: "Russell King (Oracle)" To: Ling Pei Lee Cc: Andrew Lunn , Heiner Kallweit , davem@davemloft.net, Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Behun , weifeng.voon@intel.com, vee.khee.wong@linux.intel.com, vee.khee.wong@intel.com Subject: Re: [PATCH net-next] net: phy: marvell10g: enable WoL for mv2110 Message-ID: <20210623200618.GO22278@shell.armlinux.org.uk> References: <20210623130929.805559-1-pei.lee.ling@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210623130929.805559-1-pei.lee.ling@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 09:09:29PM +0800, Ling Pei Lee wrote: > +static void mv2110_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) > +{ > + int ret = 0; This initialiser doesn't do anything. > + > + wol->supported = WAKE_MAGIC; > + wol->wolopts = 0; > + > + ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_WOL_CTRL); > + > + if (ret & MV_V2_WOL_MAGIC_PKT_EN) > + wol->wolopts |= WAKE_MAGIC; You need to check whether "ret" is a negative number - if phy_read_mmd() returns an error, this test could be true or false. It would be better to have well defined behaviour (e.g. reporting that WOL is disabled?) > + /* Reset the clear WOL status bit as it does not self-clear */ > + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, > + MV_V2_WOL_CTRL, > + MV_V2_WOL_CLEAR_STS); > + > + if (ret < 0) > + return ret; > + } else { > + /* Disable magic packet matching & reset WOL status bit */ > + ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, > + MV_V2_WOL_CTRL, > + MV_V2_WOL_MAGIC_PKT_EN, > + MV_V2_WOL_CLEAR_STS); > + > + if (ret < 0) > + return ret; > + > + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, > + MV_V2_WOL_CTRL, > + MV_V2_WOL_CLEAR_STS); > + > + if (ret < 0) > + return ret; This phy_clear_bits_mmd() is the same as the tail end of the other part of the if() clause. Consider moving it after the if () { } else { } statement... > + } > + > + return ret; and as all paths return "ret" just do: return phy_clear_bits_mmd(... I will also need to check whether this is the same as the 88x3310, but I'm afraid I don't have the energy this evening - please email me a remind to look at this tomorrow. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!