Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18676455ybl; Fri, 3 Jan 2020 07:00:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxaTB5Mp1OTRHSmjW/KVaaQefGKI8gG9r5yTbMsYGNpMP/q4mjEdI66VTsJB2DoVEr44NxJ X-Received: by 2002:a9d:2965:: with SMTP id d92mr93026550otb.175.1578063641810; Fri, 03 Jan 2020 07:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578063641; cv=none; d=google.com; s=arc-20160816; b=WX6IGZG8tvNe8QpA1R+h7Y4BiLZ2H24w6p0Lb2/uash8tbNmcIihqwyatEYpoTLNRE 173zsTUQ6wGcoEl9e8p7YRg7D182gpZKG3bR6Jy5cePYGCinlbXyvDYwTrsai+OJh149 U+wEllO0uylpRRoSIuTyOCbqhBbtz5bLDoRyBWCWQj3QWkVQOTUj0YuflUGmKaqXGB9X p5MkCC8+xPYnSYMU+ZliLHhq57w856jVFFhV8OckqfAiyG/J8BzPvLMPeoAfEtfUkIkp f8+5ig0yTN68jd1WPj6ZpJwhlg7Ak2AyeNSTyOaNGLu2dbqLqYUeY1bCCFnzuIsyPnw9 k9HA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=hGov7G+gZRI0h78/9bKm8m4+rNegcQZDJnztiBBrivw=; b=GEnYG6s7BciqXI4WBCmrboxcejuereINlv6W/5tCV63Xc5JRvvvAcvrVbXBin/MREE olx/5ee2+jIfT37JOI8+TVgQsx8It95Ds1NAtAXhFDwSmx5TZZrEyj7MFXPizlQ7gSbf v7g6DmJzISL1b/KJW5BP7ZhFvmx1SLn8ayfSET5/xL2TXNK00S+560gyWk2rgiYZvQvg GRiK51Omk/2CZRwp/k4Whx6HpA+8HwlQ1x2yXXU0G4LT8FGj598RAQnyARvQyUDcYeXw dFANQ3pc1S+84gcfG0jp4w9ATCgFbh9BTY7eqWcTo1bHQhj8DL1aPnYXGddijtdfJ3mc /v6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si29835742ota.103.2020.01.03.07.00.29; Fri, 03 Jan 2020 07:00:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727908AbgACO7P (ORCPT + 99 others); Fri, 3 Jan 2020 09:59:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:39180 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbgACO7P (ORCPT ); Fri, 3 Jan 2020 09:59:15 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B5235ACCA; Fri, 3 Jan 2020 14:59:13 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id B8231E0473; Fri, 3 Jan 2020 15:59:11 +0100 (CET) Date: Fri, 3 Jan 2020 15:59:11 +0100 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Matthew Wilcox , yu kuai , klassert@kernel.org, davem@davemloft.net, hkallweit1@gmail.com, jakub.kicinski@netronome.com, hslester96@gmail.com, mst@redhat.com, yang.wei9@zte.com.cn, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, zhengbin13@huawei.com Subject: Re: [PATCH] net: 3com: 3c59x: remove set but not used variable 'mii_reg1' Message-ID: <20200103145911.GA22387@unicorn.suse.cz> References: <20200103121907.5769-1-yukuai3@huawei.com> <20200103144623.GI6788@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200103144623.GI6788@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 03, 2020 at 06:46:23AM -0800, Matthew Wilcox wrote: > On Fri, Jan 03, 2020 at 08:19:07PM +0800, yu kuai wrote: > > Fixes gcc '-Wunused-but-set-variable' warning: > > > > drivers/net/ethernet/3com/3c59x.c: In function ‘vortex_up’: > > drivers/net/ethernet/3com/3c59x.c:1551:9: warning: variable > > ‘mii_reg1’ set but not used [-Wunused-but-set-variable] > > > > It is never used, and so can be removed. > ... > > if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) { > > - mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR); > > mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); > > I know nothing about the MII interface, but in general this is not > a safe thing to do. You're removing a read from a device register. > Register reads can have side effects. I'm actually quite surprised > that GCC emits this warning, since there should be some kind of > volatile cast in mdio_read() to let GCC know that something unusual > is going on here. Removing the call may be wrong (and certainly isn't obviously correct) but the warning makes sense, IMHO: if the return value is not used anywhere, there is no point assigning it to a variable. Michal Kubecek