From patchwork Wed Oct 13 09:36:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 67665 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E71FFB70D1 for ; Wed, 13 Oct 2010 20:36:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750776Ab0JMJgc (ORCPT ); Wed, 13 Oct 2010 05:36:32 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:55073 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730Ab0JMJgb (ORCPT ); Wed, 13 Oct 2010 05:36:31 -0400 Received: by wwj40 with SMTP id 40so6213788wwj.1 for ; Wed, 13 Oct 2010 02:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=NvWtH3HVjmlfe4Ubz+zmya4Ip/fbqtU4bCZPvWEfpQk=; b=NyrBppZdr4L6dpLMQYKB4jIusIYGwIFZ2iHt/vXfs+kBT4Gzjwau1Y9PaFkZUAyKBZ l/KeornzTIsJtemOaxvFM1hQ/3flwHAQ5frgJ9effAzHYERF3mMYiYwtOEK/DpHucHcd bMSClbb9X/TdxWed+z/Zf/XxPHdU6RIZBVhRk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=N68W2UdSgadscaNMRn5epU5OBu9HjmBpxB9ZqmyAJkBff9DPslGVeJqYrZoSxPhsrZ BOHlFjJtJMGv8Fpo2HWVGM05Q/+lzgS4+fnstI8hxodMkxWAyebsSXH1K4lpby0PqtHn 9RQKidF10FG+bIwnuYEv7mi0WG9zimQh9Qfs8= Received: by 10.216.50.18 with SMTP id y18mr95909web.113.1286962590152; Wed, 13 Oct 2010 02:36:30 -0700 (PDT) Received: from bicker (h3f06.n1.ips.mtn.co.ug [41.210.191.6]) by mx.google.com with ESMTPS id x23sm4157264weq.10.2010.10.13.02.36.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 Oct 2010 02:36:29 -0700 (PDT) Date: Wed, 13 Oct 2010 11:36:19 +0200 From: Dan Carpenter To: netdev@vger.kernel.org Cc: Masayuki Ohtake , "David S. Miller" , kernel-janitors@vger.kernel.org Subject: [patch -next] pch_gbe: fix if condition in set_settings() Message-ID: <20101013093619.GC6060@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There were no curly braces in this if condition so it always enabled full duplex. And ecmd->speed is an unsigned short so it is never equal to -1. The effect is that mii_ethtool_sset() fails with -EINVAL and an error is printed to dmesg. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c index e06c6ae..c8cc32c 100644 --- a/drivers/net/pch_gbe/pch_gbe_ethtool.c +++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c @@ -113,9 +113,10 @@ static int pch_gbe_set_settings(struct net_device *netdev, pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET); - if (ecmd->speed == -1) + if (ecmd->speed == USHRT_MAX) { ecmd->speed = SPEED_1000; ecmd->duplex = DUPLEX_FULL; + } ret = mii_ethtool_sset(&adapter->mii, ecmd); if (ret) { pr_err("Error: mii_ethtool_sset\n");