From patchwork Tue Mar 11 23:02:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3814851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 365C69F1CD for ; Tue, 11 Mar 2014 23:08:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 618E620263 for ; Tue, 11 Mar 2014 23:08:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A70A20260 for ; Tue, 11 Mar 2014 23:08:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNVmp-0005fI-LI; Tue, 11 Mar 2014 23:08:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNVhx-0007ov-RI; Tue, 11 Mar 2014 23:03:37 +0000 Received: from mail-ee0-f47.google.com ([74.125.83.47]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNVhv-0007n8-7h for linux-arm-kernel@lists.infradead.org; Tue, 11 Mar 2014 23:03:36 +0000 Received: by mail-ee0-f47.google.com with SMTP id b15so3958957eek.6 for ; Tue, 11 Mar 2014 16:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=02KCydiR+jZwMhbSt7W3+jAN53vV11GgVgVIMfnyczw=; b=GNURxrPjv7C7D7YbWQ0Im9OJysVkyVvmboJFWyam209WwP4qCwddU/vpxbV6cdog3O j5Op8dGg+mbc8ccN9kF0IqqmZs3bXpoLRdyb0b9dcRVtnjPElMjiuTERFo66ppPU1HxC UXcrBww1w1U4Svx+nbs7W1QFdQm2hUv4aF09T/w+y9BJ/l7zwzC0I3MEI+jV+pR9TTgU mF26NnH2L+53GsaPhTlH+b7zbmolSK55jvK4ozOpNBOe4hK5C9SyxKwAfcTC51N0mjJF f51Z4NURfuwSlqwfAzwSd6aKNDHis+QLPF+/7mfAuxHOFHpc8Iw+m58XCdbgKqxvBIe/ 6tEw== X-Received: by 10.15.60.199 with SMTP id g47mr44394662eex.37.1394578989224; Tue, 11 Mar 2014 16:03:09 -0700 (PDT) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id 46sm62778248ees.4.2014.03.11.16.03.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Mar 2014 16:03:08 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v3] net: phy: fix uninitalized WOL parameters in phy_ethtool_get_wol Date: Wed, 12 Mar 2014 00:02:55 +0100 Message-Id: <1394578975-12588-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1394484661-4554-2-git-send-email-sebastian.hesselbarth@gmail.com> References: <1394484661-4554-2-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140311_190335_394511_7F8AFF22 X-CRM114-Status: GOOD ( 11.59 ) X-Spam-Score: -2.7 (--) Cc: Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Hutchings , David Miller , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP phy_ethtool_get_wol is a helper to get current WOL settings from a phy device. When using this helper on a PHY without .get_wol callback, struct ethtool_wolinfo is never set-up correctly and may contain misleading information about WOL status. To fix this, always zero relevant fields of struct ethtool_wolinfo regardless of .get_wol callback availability. Signed-off-by: Sebastian Hesselbarth Reviewed-by: Florian Fainelli --- Changelog: v1->v2: - clear whole struct ethtool_wolinfo - check for non-NULL phy_device v2->v3: - only clear ->supported and ->wolopts (Suggested by Ben Hutchings) Cc: David Miller Cc: Florian Fainelli Cc: Ben Hutchings Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 19c9eca0ef26..94234a91a50f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1092,7 +1092,9 @@ EXPORT_SYMBOL(phy_ethtool_set_wol); void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) { - if (phydev->drv->get_wol) + wol->supported = wol->wolopts = 0; + + if (phydev && phydev->drv->get_wol) phydev->drv->get_wol(phydev, wol); } EXPORT_SYMBOL(phy_ethtool_get_wol);