From patchwork Thu Oct 1 22:27:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentine Barshak X-Patchwork-Id: 34790 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id A432C100A11 for ; Fri, 2 Oct 2009 09:30:48 +1000 (EST) Received: by ozlabs.org (Postfix) id 94C02B7BDD; Fri, 2 Oct 2009 09:30:42 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 3756 seconds by postgrey-1.32 at bilbo; Fri, 02 Oct 2009 09:30:41 EST Received: from localhost.localdomain (unknown [93.100.123.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D3938B7BDC for ; Fri, 2 Oct 2009 09:30:37 +1000 (EST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3) with ESMTP id n91MRxJY021287; Fri, 2 Oct 2009 02:27:59 +0400 Received: (from vaxon@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id n91MRmOT021285; Fri, 2 Oct 2009 02:27:48 +0400 X-Authentication-Warning: localhost.localdomain: vaxon set sender to vbarshak@ru.mvista.com using -f Date: Fri, 2 Oct 2009 02:27:48 +0400 From: Valentine Barshak To: linuxppc-dev@ozlabs.org Subject: [PATCH] pasemi_mac: ethtool get settings fix Message-ID: <20091001222748.GA21276@ru.mvista.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: netdev@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Not all pasemi mac interfaces can have a phy attached. For example, XAUI has no phy and phydev is NULL for it. In this case ethtool get settings causes kernel crash. Fix it by returning -EOPNOTSUPP if there's no PHY attached. Signed-off-by: Valentine Barshak --- drivers/net/pasemi_mac_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) --- linux-2.6.21.orig/drivers/net/pasemi_mac_ethtool.c 2008-11-06 18:10:38.000000000 +0300 +++ linux-2.6.21/drivers/net/pasemi_mac_ethtool.c 2008-11-19 19:24:28.000000000 +0300 @@ -71,6 +71,8 @@ pasemi_mac_ethtool_get_settings(struct n struct pasemi_mac *mac = netdev_priv(netdev); struct phy_device *phydev = mac->phydev; + if (!phydev) + return -EOPNOTSUPP; return phy_ethtool_gset(phydev, cmd); }